Package org.conscrypt
Class OpenSSLCipherRSA
java.lang.Object
javax.crypto.CipherSpi
org.conscrypt.OpenSSLCipherRSA
- Direct Known Subclasses:
OpenSSLCipherRSA.DirectRSA
,OpenSSLCipherRSA.OAEP
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]
Buffer for operationsprivate int
Current offset in the buffer.(package private) boolean
Current cipher mode: encrypting or decrypting.private boolean
Flag that indicates an exception should be thrown when the input is too large during doFinal.(package private) OpenSSLKey
The current OpenSSL key we're operating on.(package private) int
Current padding mode(package private) boolean
Current key type: private or public. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
(package private) abstract int
doCryptoOperation
(byte[] tmpBuf, byte[] output) protected byte[]
engineDoFinal
(byte[] input, int inputOffset, int inputLen) protected int
engineDoFinal
(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) protected int
protected byte[]
protected int
engineGetKeySize
(Key key) protected int
engineGetOutputSize
(int inputLen) protected AlgorithmParameters
protected void
engineInit
(int opmode, Key key, AlgorithmParameters params, SecureRandom random) protected void
engineInit
(int opmode, Key key, SecureRandom random) protected void
engineInit
(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) (package private) void
engineInitInternal
(int opmode, Key key, AlgorithmParameterSpec spec) protected void
engineSetMode
(String mode) protected void
engineSetPadding
(String padding) protected Key
engineUnwrap
(byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType) protected byte[]
engineUpdate
(byte[] input, int inputOffset, int inputLen) protected int
engineUpdate
(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) protected byte[]
engineWrap
(Key key) (package private) boolean
Returnstrue
if the cipher has been initialized.(package private) int
(package private) int
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineUpdate, engineUpdateAAD, engineUpdateAAD
-
Field Details
-
key
OpenSSLKey keyThe current OpenSSL key we're operating on. -
usingPrivateKey
boolean usingPrivateKeyCurrent key type: private or public. -
encrypting
boolean encryptingCurrent cipher mode: encrypting or decrypting. -
buffer
private byte[] bufferBuffer for operations -
bufferOffset
private int bufferOffsetCurrent offset in the buffer. -
inputTooLarge
private boolean inputTooLargeFlag that indicates an exception should be thrown when the input is too large during doFinal. -
padding
int paddingCurrent padding mode
-
-
Constructor Details
-
OpenSSLCipherRSA
OpenSSLCipherRSA(int padding)
-
-
Method Details
-
engineSetMode
- Specified by:
engineSetMode
in classCipherSpi
- Throws:
NoSuchAlgorithmException
-
engineSetPadding
- Specified by:
engineSetPadding
in classCipherSpi
- Throws:
NoSuchPaddingException
-
engineGetBlockSize
protected int engineGetBlockSize()- Specified by:
engineGetBlockSize
in classCipherSpi
-
engineGetOutputSize
protected int engineGetOutputSize(int inputLen) - Specified by:
engineGetOutputSize
in classCipherSpi
-
paddedBlockSizeBytes
int paddedBlockSizeBytes() -
keySizeBytes
int keySizeBytes() -
isInitialized
boolean isInitialized()Returnstrue
if the cipher has been initialized. -
engineGetIV
protected byte[] engineGetIV()- Specified by:
engineGetIV
in classCipherSpi
-
engineGetParameters
- Specified by:
engineGetParameters
in classCipherSpi
-
doCryptoInit
void doCryptoInit(AlgorithmParameterSpec spec) throws InvalidAlgorithmParameterException, InvalidKeyException -
engineInitInternal
void engineInitInternal(int opmode, Key key, AlgorithmParameterSpec spec) throws InvalidKeyException, InvalidAlgorithmParameterException -
engineGetKeySize
- Overrides:
engineGetKeySize
in classCipherSpi
- Throws:
InvalidKeyException
-
engineInit
- Specified by:
engineInit
in classCipherSpi
- Throws:
InvalidKeyException
-
engineInit
protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInit
in classCipherSpi
- Throws:
InvalidKeyException
InvalidAlgorithmParameterException
-
engineInit
protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInit
in classCipherSpi
- Throws:
InvalidKeyException
InvalidAlgorithmParameterException
-
engineUpdate
protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) - Specified by:
engineUpdate
in classCipherSpi
-
engineUpdate
protected int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException - Specified by:
engineUpdate
in classCipherSpi
- Throws:
ShortBufferException
-
engineDoFinal
protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException - Specified by:
engineDoFinal
in classCipherSpi
- Throws:
IllegalBlockSizeException
BadPaddingException
-
doCryptoOperation
abstract int doCryptoOperation(byte[] tmpBuf, byte[] output) throws BadPaddingException, IllegalBlockSizeException -
engineDoFinal
protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException - Specified by:
engineDoFinal
in classCipherSpi
- Throws:
ShortBufferException
IllegalBlockSizeException
BadPaddingException
-
engineWrap
- Overrides:
engineWrap
in classCipherSpi
- Throws:
IllegalBlockSizeException
InvalidKeyException
-
engineUnwrap
protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException - Overrides:
engineUnwrap
in classCipherSpi
- Throws:
InvalidKeyException
NoSuchAlgorithmException
-