|
Bouncy Castle Cryptography 1.48 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.crypto.CipherSpi
org.bouncycastle.pqc.jcajce.provider.util.CipherSpiExt
org.bouncycastle.pqc.jcajce.provider.util.AsymmetricHybridCipher
public abstract class AsymmetricHybridCipher
The AsymmetricHybridCipher class extends CipherSpiExt. NOTE: Some Ciphers are using Padding. OneAndZeroesPadding is used as default padding. However padding can still be specified, but mode is not supported; if you try to instantiate the cipher with something else than "NONE" as mode, NoSuchAlgorithmException is thrown.
Field Summary | |
---|---|
protected java.security.spec.AlgorithmParameterSpec |
paramSpec
ParameterSpec used with this cipher |
Fields inherited from class org.bouncycastle.pqc.jcajce.provider.util.CipherSpiExt |
---|
DECRYPT_MODE, ENCRYPT_MODE, opMode |
Constructor Summary | |
---|---|
AsymmetricHybridCipher()
|
Method Summary | |
---|---|
protected abstract int |
decryptOutputSize(int inLen)
Compute the output size of an update() or doFinal() operation of a hybrid asymmetric cipher in decryption mode when given input of the specified length. |
abstract byte[] |
doFinal(byte[] input,
int inOff,
int inLen)
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized). |
int |
doFinal(byte[] input,
int inOff,
int inLen,
byte[] output,
int outOff)
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized). |
protected abstract int |
encryptOutputSize(int inLen)
Compute the output size of an update() or doFinal() operation of a hybrid asymmetric cipher in encryption mode when given input of the specified length. |
int |
getBlockSize()
|
byte[] |
getIV()
Return the initialization vector. |
int |
getOutputSize(int inLen)
Return 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 inLen (in bytes). |
java.security.spec.AlgorithmParameterSpec |
getParameters()
Return the parameters used with this cipher. |
protected abstract void |
initCipherDecrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params)
Initialize the AsymmetricHybridCipher with a certain key for data encryption. |
protected abstract void |
initCipherEncrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom sr)
Initialize the AsymmetricHybridCipher with a certain key for data encryption. |
void |
initDecrypt(java.security.Key key)
Initialize the cipher for decryption by forwarding it to initDecrypt(Key, FlexiSecureRandom). |
void |
initDecrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params)
Initialize the cipher with a certain key for data decryption. |
void |
initEncrypt(java.security.Key key)
Initialize the cipher for encryption by forwarding it to initEncrypt(Key, AlgorithmParameterSpec, SecureRandom) . |
void |
initEncrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params)
Initialize the cipher for encryption by forwarding it to initEncrypt(Key, FlexiSecureRandom, AlgorithmParameterSpec). |
void |
initEncrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Initialize the cipher with a certain key for data encryption. |
void |
initEncrypt(java.security.Key key,
java.security.SecureRandom random)
Initialize this cipher for encryption by forwarding it to initEncrypt(Key, AlgorithmParameterSpec, SecureRandom) . |
protected void |
setMode(java.lang.String modeName)
Since asymmetric hybrid ciphers do not support modes, this method does nothing. |
protected void |
setPadding(java.lang.String paddingName)
Since asymmetric hybrid ciphers do not support padding, this method does nothing. |
abstract byte[] |
update(byte[] input,
int inOff,
int inLen)
Continue a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. |
int |
update(byte[] input,
int inOff,
int inLen,
byte[] output,
int outOff)
Continue a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. |
Methods inherited from class org.bouncycastle.pqc.jcajce.provider.util.CipherSpiExt |
---|
doFinal, doFinal, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, getKeySize, getName, update |
Methods inherited from class javax.crypto.CipherSpi |
---|
engineDoFinal, engineUnwrap, engineUpdate, engineWrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.security.spec.AlgorithmParameterSpec paramSpec
Constructor Detail |
---|
public AsymmetricHybridCipher()
Method Detail |
---|
protected final void setMode(java.lang.String modeName)
setMode
in class CipherSpiExt
modeName
- the cipher mode (unused)protected final void setPadding(java.lang.String paddingName)
setPadding
in class CipherSpiExt
paddingName
- the name of the padding scheme (not used)public final byte[] getIV()
CipherSpiExt
getIV
in class CipherSpiExt
public final int getBlockSize()
getBlockSize
in class CipherSpiExt
public final java.security.spec.AlgorithmParameterSpec getParameters()
getParameters
in class CipherSpiExt
public final int getOutputSize(int inLen)
getOutputSize
in class CipherSpiExt
inLen
- the length of the input
public final void initEncrypt(java.security.Key key) throws java.security.InvalidKeyException
initEncrypt(Key, AlgorithmParameterSpec, SecureRandom)
.
If this cipher requires any algorithm parameters that cannot be derived
from the given key, the underlying cipher implementation is supposed to
generate the required parameters itself (using provider-specific default
or random values) if it is being initialized for encryption, and raise an
InvalidKeyException if it is being initialized for decryption. The
generated parameters can be retrieved using getParameters()
.
key
- the encryption key
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher.
java.security.InvalidParameterException
- if this cipher needs algorithm parameters for
initialization and cannot generate parameters itself.public final void initEncrypt(java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException
initEncrypt(Key, AlgorithmParameterSpec, SecureRandom)
.
If this cipher requires any algorithm parameters that cannot be derived
from the given key, the underlying cipher implementation is supposed to
generate the required parameters itself (using provider-specific default
or random values) if it is being initialized for encryption, and raise an
InvalidKeyException if it is being initialized for decryption. The
generated parameters can be retrieved using getParameters()
.
key
- the encryption keyrandom
- the source of randomness
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher.
java.security.InvalidParameterException
- if this cipher needs algorithm parameters for
initialization and cannot generate parameters itself.public final void initEncrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
key
- the encryption keyparams
- the algorithm parameters
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher.
java.security.InvalidAlgorithmParameterException
- if the given algorithm parameters are inappropriate for
this cipher, or if this cipher is initialized with
null parameters and cannot generate parameters
itself.public final void initEncrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
initEncrypt
in class CipherSpiExt
key
- the encryption keyrandom
- the source of randomnessparams
- the algorithm parameters
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher
java.security.InvalidAlgorithmParameterException
- if the given algorithm parameters are inappropriate for
this cipher, or if this cipher is initialized with
null parameters and cannot generate parameters
itself.public final void initDecrypt(java.security.Key key) throws java.security.InvalidKeyException
getParameters()
.
key
- the decryption key
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher.public final void initDecrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
initDecrypt
in class CipherSpiExt
key
- the decryption keyparams
- the algorithm parameters
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher
java.security.InvalidAlgorithmParameterException
- if the given algorithm parameters are inappropriate for
this cipher, or if this cipher is initialized with
null parameters and cannot generate parameters
itself.public abstract byte[] update(byte[] input, int inOff, int inLen)
update
in class CipherSpiExt
input
- the input bufferinOff
- the offset where the input startsinLen
- the input length
public final int update(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException
update
in class CipherSpiExt
input
- the input bufferinOff
- the offset where the input startsinLen
- the input lengthoutput
- the output bufferoutOff
- the offset where the result is stored
javax.crypto.ShortBufferException
- if the output buffer is too small to hold the result.public abstract byte[] doFinal(byte[] input, int inOff, int inLen) throws javax.crypto.BadPaddingException
doFinal
in class CipherSpiExt
input
- the input bufferinOff
- the offset where the input startsinLen
- the input length
javax.crypto.BadPaddingException
- if the ciphertext is invalid.public final int doFinal(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException, javax.crypto.BadPaddingException
doFinal
in class CipherSpiExt
input
- the input bufferinOff
- the offset where the input startsinLen
- the input lengthoutput
- the buffer for the resultoutOff
- the offset where the result is stored
javax.crypto.ShortBufferException
- if the output buffer is too small to hold the result.
javax.crypto.BadPaddingException
- if the ciphertext is invalid.protected abstract int encryptOutputSize(int inLen)
inLen
- the length of the input
protected abstract int decryptOutputSize(int inLen)
inLen
- the length of the input
protected abstract void initCipherEncrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom sr) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
key
- the key which has to be used to encrypt dataparams
- the algorithm parameterssr
- the source of randomness
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher.
java.security.InvalidAlgorithmParameterException
- if the given parameters are inappropriate for
initializing this cipher.protected abstract void initCipherDecrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
key
- the key which has to be used to decrypt dataparams
- the algorithm parameters
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
cipher
java.security.InvalidAlgorithmParameterException
- if the given parameters are inappropriate for
initializing this cipher.
|
Bouncy Castle Cryptography 1.48 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |