Top Inners Fields Constructors Methods
org.conscrypt

public abstract Class OpenSSLCipherRSA

extends CipherSpi
Class Inheritance
Known Direct Subclasses
org.conscrypt.OpenSSLCipherRSA.DirectRSA, org.conscrypt.OpenSSLCipherRSA.OAEP
Annotations
@Internal
Imports
java.security.AlgorithmParameters, .InvalidAlgorithmParameterException, .InvalidKeyException, .InvalidParameterException, .Key, .KeyFactory, .NoSuchAlgorithmException, .PrivateKey, .PublicKey, .SecureRandom, .SignatureException, java.security.interfaces.RSAPrivateCrtKey, .RSAPrivateKey, .RSAPublicKey, java.security.spec.AlgorithmParameterSpec, .InvalidKeySpecException, .InvalidParameterSpecException, .MGF1ParameterSpec, .PKCS8EncodedKeySpec, .X509EncodedKeySpec, java.util.Arrays, .Locale, javax.crypto.BadPaddingException, .Cipher, .CipherSpi, .IllegalBlockSizeException, .NoSuchPaddingException, .ShortBufferException, javax.crypto.spec.OAEPParameterSpec, .PSource, .SecretKeySpec

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private byte[]
buffer

Buffer for operations

private int
bufferOffset

Current offset in the buffer.

pack-priv boolean
encrypting

Current cipher mode: encrypting or decrypting.

private boolean
inputTooLarge

Flag that indicates an exception should be thrown when the input is too large during doFinal.

pack-priv OpenSSLKey
key

The current OpenSSL key we're operating on.

pack-priv int
padding

Current padding mode

pack-priv boolean
usingPrivateKey

Current key type: private or public.

Constructor Summary

AccessConstructor and Description
pack-priv
OpenSSLCipherRSA(int padding)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv abstract int
doCryptoOperation(final byte[] tmpBuf, byte[] output)

protected byte[]
engineDoFinal(byte[]
the input buffer
input
,
int
the offset in input where the input starts
inputOffset
,
int
the input length
inputLen
)

Implements abstract javax.crypto.CipherSpi.engineDoFinal.

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.
protected int
engineDoFinal(byte[]
the input buffer
input
,
int
the offset in input where the input starts
inputOffset
,
int
the input length
inputLen
,
byte[]
the buffer for the result
output
,
int
the offset in output where the result is stored
outputOffset
)

Implements abstract javax.crypto.CipherSpi.engineDoFinal.

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.
protected int
engineGetBlockSize()

Implements abstract javax.crypto.CipherSpi.engineGetBlockSize.

Returns the block size (in bytes).
protected byte[]
engineGetIV()

Implements abstract javax.crypto.CipherSpi.engineGetIV.

Returns the initialization vector (IV) in a new buffer.
protected int
engineGetKeySize(Key
the key object
key
)

Overrides javax.crypto.CipherSpi.engineGetKeySize.

Returns the key size of the given key object in bits.
protected int
engineGetOutputSize(int
the input length (in bytes)
inputLen
)

Implements abstract javax.crypto.CipherSpi.engineGetOutputSize.

Returns the length in bytes that an output buffer would need to be in order to hold the result of the next update or doFinal operation, given the input length inputLen (in bytes).
protected AlgorithmParameters
engineGetParameters()

Implements abstract javax.crypto.CipherSpi.engineGetParameters.

Returns the parameters used with this cipher.
protected void
engineInit(int
the operation mode of this CipherSpi object (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE)
opmode
,
Key
the encryption key
key
,
SecureRandom
the source of randomness
random
)

Implements abstract javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key and a source of randomness.
protected void
engineInit(int
the operation mode of this CipherSpi object (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE, or UNWRAP_MODE)
opmode
,
Key
the encryption key
key
,
AlgorithmParameterSpec
the algorithm parameters
params
,
SecureRandom
the source of randomness
random
)

Implements abstract javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.
protected void
engineInit(int
the operation mode of this CipherSpi object (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE, or UNWRAP_MODE)
opmode
,
Key
the encryption key
key
,
AlgorithmParameters
the algorithm parameters
params
,
SecureRandom
the source of randomness
random
)

Implements abstract javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.
pack-priv void
protected void
engineSetMode(String
the cipher mode
mode
)

Implements abstract javax.crypto.CipherSpi.engineSetMode.

Sets the mode of this cipher.
protected void
engineSetPadding(String
the padding mechanism
padding
)

Implements abstract javax.crypto.CipherSpi.engineSetPadding.

Sets the padding mechanism of this cipher.
protected Key
engineUnwrap(byte[]
the key to be unwrapped
wrappedKey
,
String
the algorithm associated with the wrapped key
wrappedKeyAlgorithm
,
int
the type of the wrapped key. This is one of SECRET_KEY, PRIVATE_KEY, or PUBLIC_KEY.
wrappedKeyType
)

Overrides javax.crypto.CipherSpi.engineUnwrap.

Unwrap a previously wrapped key.
protected byte[]
engineUpdate(byte[]
the input buffer
input
,
int
the offset in input where the input starts
inputOffset
,
int
the input length
inputLen
)

Implements abstract javax.crypto.CipherSpi.engineUpdate.

Continues a multiple-part encryption or decryption operation (depending on how this CipherSpi object was initialized), processing another data part.
protected int
engineUpdate(byte[]
the input buffer
input
,
int
the offset in input where the input starts
inputOffset
,
int
the input length
inputLen
,
byte[]
the buffer for the result
output
,
int
the offset in output where the result is stored
outputOffset
)

Implements abstract javax.crypto.CipherSpi.engineUpdate.

Continues a multiple-part encryption or decryption operation (depending on how this CipherSpi object was initialized), processing another data part.
protected byte[]
engineWrap(Key
the key to be wrapped
key
)

Overrides javax.crypto.CipherSpi.engineWrap.

Wrap a key.
pack-priv boolean
isInitialized()

Returns true if the cipher has been initialized.

pack-priv int
pack-priv int
Inherited from javax.crypto.CipherSpi:
engineDoFinalengineUpdateengineUpdateAADengineUpdateAAD