Package org.conscrypt
Class OpenSSLCipherRSA
- java.lang.Object
-
- javax.crypto.CipherSpi
-
- org.conscrypt.OpenSSLCipherRSA
-
- Direct Known Subclasses:
OpenSSLCipherRSA.DirectRSA
,OpenSSLCipherRSA.OAEP
@Internal public abstract class OpenSSLCipherRSA extends javax.crypto.CipherSpi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpenSSLCipherRSA.DirectRSA
static class
OpenSSLCipherRSA.OAEP
static class
OpenSSLCipherRSA.PKCS1
static class
OpenSSLCipherRSA.Raw
-
Field Summary
Fields Modifier and Type Field Description private byte[]
buffer
Buffer for operationsprivate int
bufferOffset
Current offset in the buffer.(package private) 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.(package private) OpenSSLKey
key
The current OpenSSL key we're operating on.(package private) int
padding
Current padding mode(package private) boolean
usingPrivateKey
Current key type: private or public.
-
Constructor Summary
Constructors Constructor Description OpenSSLCipherRSA(int padding)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
doCryptoInit(java.security.spec.AlgorithmParameterSpec spec)
(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
engineGetBlockSize()
protected byte[]
engineGetIV()
protected int
engineGetKeySize(java.security.Key key)
protected int
engineGetOutputSize(int inputLen)
protected java.security.AlgorithmParameters
engineGetParameters()
protected void
engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)
protected void
engineInit(int opmode, java.security.Key key, java.security.SecureRandom random)
protected void
engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
(package private) void
engineInitInternal(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec spec)
protected void
engineSetMode(java.lang.String mode)
protected void
engineSetPadding(java.lang.String padding)
protected java.security.Key
engineUnwrap(byte[] wrappedKey, java.lang.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(java.security.Key key)
(package private) boolean
isInitialized()
Returnstrue
if the cipher has been initialized.(package private) int
keySizeBytes()
(package private) int
paddedBlockSizeBytes()
-
-
-
Field Detail
-
key
OpenSSLKey key
The current OpenSSL key we're operating on.
-
usingPrivateKey
boolean usingPrivateKey
Current key type: private or public.
-
encrypting
boolean encrypting
Current cipher mode: encrypting or decrypting.
-
buffer
private byte[] buffer
Buffer for operations
-
bufferOffset
private int bufferOffset
Current offset in the buffer.
-
inputTooLarge
private boolean inputTooLarge
Flag that indicates an exception should be thrown when the input is too large during doFinal.
-
padding
int padding
Current padding mode
-
-
Method Detail
-
engineSetMode
protected void engineSetMode(java.lang.String mode) throws java.security.NoSuchAlgorithmException
- Specified by:
engineSetMode
in classjavax.crypto.CipherSpi
- Throws:
java.security.NoSuchAlgorithmException
-
engineSetPadding
protected void engineSetPadding(java.lang.String padding) throws javax.crypto.NoSuchPaddingException
- Specified by:
engineSetPadding
in classjavax.crypto.CipherSpi
- Throws:
javax.crypto.NoSuchPaddingException
-
engineGetBlockSize
protected int engineGetBlockSize()
- Specified by:
engineGetBlockSize
in classjavax.crypto.CipherSpi
-
engineGetOutputSize
protected int engineGetOutputSize(int inputLen)
- Specified by:
engineGetOutputSize
in classjavax.crypto.CipherSpi
-
paddedBlockSizeBytes
int paddedBlockSizeBytes()
-
keySizeBytes
int keySizeBytes()
-
isInitialized
boolean isInitialized()
Returnstrue
if the cipher has been initialized.
-
engineGetIV
protected byte[] engineGetIV()
- Specified by:
engineGetIV
in classjavax.crypto.CipherSpi
-
engineGetParameters
protected java.security.AlgorithmParameters engineGetParameters()
- Specified by:
engineGetParameters
in classjavax.crypto.CipherSpi
-
doCryptoInit
void doCryptoInit(java.security.spec.AlgorithmParameterSpec spec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException
-
engineInitInternal
void engineInitInternal(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec spec) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
-
engineGetKeySize
protected int engineGetKeySize(java.security.Key key) throws java.security.InvalidKeyException
- Overrides:
engineGetKeySize
in classjavax.crypto.CipherSpi
- Throws:
java.security.InvalidKeyException
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException
- Specified by:
engineInit
in classjavax.crypto.CipherSpi
- Throws:
java.security.InvalidKeyException
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
- Specified by:
engineInit
in classjavax.crypto.CipherSpi
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
- Specified by:
engineInit
in classjavax.crypto.CipherSpi
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
-
engineUpdate
protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
- Specified by:
engineUpdate
in classjavax.crypto.CipherSpi
-
engineUpdate
protected int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException
- Specified by:
engineUpdate
in classjavax.crypto.CipherSpi
- Throws:
javax.crypto.ShortBufferException
-
engineDoFinal
protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
- Specified by:
engineDoFinal
in classjavax.crypto.CipherSpi
- Throws:
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
-
doCryptoOperation
abstract int doCryptoOperation(byte[] tmpBuf, byte[] output) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
- Throws:
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
-
engineDoFinal
protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
- Specified by:
engineDoFinal
in classjavax.crypto.CipherSpi
- Throws:
javax.crypto.ShortBufferException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
-
engineWrap
protected byte[] engineWrap(java.security.Key key) throws javax.crypto.IllegalBlockSizeException, java.security.InvalidKeyException
- Overrides:
engineWrap
in classjavax.crypto.CipherSpi
- Throws:
javax.crypto.IllegalBlockSizeException
java.security.InvalidKeyException
-
engineUnwrap
protected java.security.Key engineUnwrap(byte[] wrappedKey, java.lang.String wrappedKeyAlgorithm, int wrappedKeyType) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
- Overrides:
engineUnwrap
in classjavax.crypto.CipherSpi
- Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
-
-