|
Bouncy Castle Cryptography Library 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
public abstract class CipherSpiExt
The CipherSpiExt class extends CipherSpi.
Field Summary | |
---|---|
static int |
DECRYPT_MODE
Constant specifying decrypt mode. |
static int |
ENCRYPT_MODE
Constant specifying encrypt mode. |
protected int |
opMode
The operation mode for this cipher ( ENCRYPT_MODE or
DECRYPT_MODE ). |
Constructor Summary | |
---|---|
CipherSpiExt()
|
Method Summary | |
---|---|
byte[] |
doFinal()
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized). |
byte[] |
doFinal(byte[] input)
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized). |
abstract byte[] |
doFinal(byte[] input,
int inOff,
int inLen)
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized). |
abstract 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 byte[] |
engineDoFinal(byte[] input,
int inOff,
int inLen)
Return the result of the last step of a multi-step en-/decryption operation or the result of a single-step en-/decryption operation by processing the given input data and any remaining buffered data. |
protected int |
engineDoFinal(byte[] input,
int inOff,
int inLen,
byte[] output,
int outOff)
Perform the last step of a multi-step en-/decryption operation or a single-step en-/decryption operation by processing the given input data and any remaining buffered data. |
protected int |
engineGetBlockSize()
|
protected byte[] |
engineGetIV()
Return the initialization vector. |
protected int |
engineGetKeySize(java.security.Key key)
Return the key size of the given key object in bits. |
protected int |
engineGetOutputSize(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 inputLen (in bytes). |
protected java.security.AlgorithmParameters |
engineGetParameters()
Returns the parameters used with this cipher. |
protected void |
engineInit(int opMode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom javaRand)
Initialize this cipher with a key, a set of algorithm parameters, and a source of randomness. |
protected void |
engineInit(int opMode,
java.security.Key key,
java.security.AlgorithmParameters algParams,
java.security.SecureRandom random)
Initialize this cipher with a key, a set of algorithm parameters, and a source of randomness. |
protected void |
engineInit(int opMode,
java.security.Key key,
java.security.SecureRandom random)
Initialize this cipher object with a proper key and some random seed. |
protected void |
engineSetMode(java.lang.String modeName)
Set the mode of this cipher. |
protected void |
engineSetPadding(java.lang.String paddingName)
Set the padding scheme of this cipher. |
protected byte[] |
engineUpdate(byte[] input,
int inOff,
int inLen)
Return the result of the next step of a multi-step en-/decryption operation. |
protected int |
engineUpdate(byte[] input,
int inOff,
int inLen,
byte[] output,
int outOff)
Perform the next step of a multi-step en-/decryption operation. |
abstract int |
getBlockSize()
|
abstract byte[] |
getIV()
Return the initialization vector. |
abstract int |
getKeySize(java.security.Key key)
Return the key size of the given key object in bits. |
abstract java.lang.String |
getName()
|
abstract int |
getOutputSize(int inputLen)
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). |
abstract java.security.spec.AlgorithmParameterSpec |
getParameters()
Returns the parameters used with this cipher. |
abstract void |
initDecrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec cipherParams)
Initialize this cipher with a key, a set of algorithm parameters, and a source of randomness for decryption. |
abstract void |
initEncrypt(java.security.Key key,
java.security.spec.AlgorithmParameterSpec cipherParams,
java.security.SecureRandom random)
Initialize this cipher with a key, a set of algorithm parameters, and a source of randomness for encryption. |
protected abstract void |
setMode(java.lang.String mode)
Set the mode of this cipher. |
protected abstract void |
setPadding(java.lang.String padding)
Set the padding mechanism of this cipher. |
byte[] |
update(byte[] input)
Continue a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. |
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. |
abstract 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 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 |
---|
public static final int ENCRYPT_MODE
public static final int DECRYPT_MODE
protected int opMode
ENCRYPT_MODE
or
DECRYPT_MODE
).
Constructor Detail |
---|
public CipherSpiExt()
Method Detail |
---|
protected final void engineInit(int opMode, java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException
engineInit
in class javax.crypto.CipherSpi
opMode
- the operation mode (ENCRYPT_MODE
or
DECRYPT_MODE
)key
- the keyrandom
- the random seed
java.security.InvalidKeyException
- if the key is inappropriate for initializing this cipher.protected final void engineInit(int opMode, java.security.Key key, java.security.AlgorithmParameters algParams, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
BlockCipher
object is initialized, it loses all
previously-acquired state. In other words, initializing a Cipher is
equivalent to creating a new instance of that Cipher and initializing it.
Note: If the mode needs an initialization vector, a try to retrieve it
from the AlgorithmParametersSpec is made.
engineInit
in class javax.crypto.CipherSpi
opMode
- the operation mode (ENCRYPT_MODE
or
DECRYPT_MODE
)key
- the keyalgParams
- the algorithm parametersrandom
- the random seed
java.security.InvalidKeyException
- if the key is inappropriate for initializing this block
cipher.
java.security.InvalidAlgorithmParameterException
- if the parameters are inappropriate for initializing this
block cipher.protected void engineInit(int opMode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom javaRand) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
engineInit
in class javax.crypto.CipherSpi
opMode
- the operation mode (ENCRYPT_MODE
or
DECRYPT_MODE
)key
- the encryption keyparams
- the algorithm parametersjavaRand
- the source of randomness
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 being initialized for
decryption and requires algorithm parameters and the
parameters are null.protected final byte[] engineDoFinal(byte[] input, int inOff, int inLen) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
engineDoFinal
in class javax.crypto.CipherSpi
input
- the byte array holding the data to be processedinOff
- the offset indicating the start position within the input
byte arrayinLen
- the number of bytes to be processed
javax.crypto.IllegalBlockSizeException
- if the ciphertext length is not a multiple of the
blocklength.
javax.crypto.BadPaddingException
- if unpadding is not possible.protected final int engineDoFinal(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
engineDoFinal
in class javax.crypto.CipherSpi
input
- the byte array holding the data to be processedinOff
- the offset indicating the start position within the input
byte arrayinLen
- the number of bytes to be processedoutput
- the byte array for holding the resultoutOff
- the offset indicating the start position within the output
byte array to which the en/decrypted data is written
javax.crypto.ShortBufferException
- if the output buffer is too short to hold the output.
javax.crypto.IllegalBlockSizeException
- if the ciphertext length is not a multiple of the
blocklength.
javax.crypto.BadPaddingException
- if unpadding is not possible.protected final int engineGetBlockSize()
engineGetBlockSize
in class javax.crypto.CipherSpi
protected final int engineGetKeySize(java.security.Key key) throws java.security.InvalidKeyException
engineGetKeySize
in class javax.crypto.CipherSpi
key
- the key object
java.security.InvalidKeyException
- if key is invalid.protected final byte[] engineGetIV()
engineGetIV
in class javax.crypto.CipherSpi
protected final int engineGetOutputSize(int inLen)
engineGetOutputSize
in class javax.crypto.CipherSpi
inLen
- the input length (in bytes)
protected final java.security.AlgorithmParameters engineGetParameters()
engineGetParameters
in class javax.crypto.CipherSpi
protected final void engineSetMode(java.lang.String modeName) throws java.security.NoSuchAlgorithmException
engineSetMode
in class javax.crypto.CipherSpi
modeName
- the cipher mode
java.security.NoSuchAlgorithmException
- if neither the mode with the given name nor the default
mode can be foundprotected final void engineSetPadding(java.lang.String paddingName) throws javax.crypto.NoSuchPaddingException
engineSetPadding
in class javax.crypto.CipherSpi
paddingName
- the padding scheme
javax.crypto.NoSuchPaddingException
- if the requested padding scheme cannot be found.protected final byte[] engineUpdate(byte[] input, int inOff, int inLen)
engineUpdate
in class javax.crypto.CipherSpi
input
- the byte array holding the data to be processedinOff
- the offset indicating the start position within the input
byte arrayinLen
- the number of bytes to be processed
protected final int engineUpdate(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException
engineUpdate
in class javax.crypto.CipherSpi
input
- the byte array holding the data to be processedinOff
- the offset indicating the start position within the input
byte arrayinLen
- the number of bytes to be processedoutput
- the byte array for holding the resultoutOff
- the offset indicating the start position within the output
byte array to which the en-/decrypted data is written
javax.crypto.ShortBufferException
- if the output buffer is too short to hold the output.public abstract void initEncrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec cipherParams, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
BlockCipher
object is initialized, it loses all
previously-acquired state. In other words, initializing a Cipher is
equivalent to creating a new instance of that Cipher and initializing it.
key
- the encryption keycipherParams
- the cipher parametersrandom
- the source of randomness
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
block cipher.
java.security.InvalidAlgorithmParameterException
- if the parameters are inappropriate for initializing this
block cipher.public abstract void initDecrypt(java.security.Key key, java.security.spec.AlgorithmParameterSpec cipherParams) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
InvalidAlgorithmParameterException
if it is being initialized for
decryption. The generated parameters can be retrieved using
engineGetParameters or engineGetIV (if the parameter is an IV).
If this cipher (including its underlying feedback or padding scheme)
requires any random bytes (e.g., for parameter generation), it will get
them from random.
Note that when a BlockCipher
object is initialized, it loses all
previously-acquired state. In other words, initializing a Cipher is
equivalent to creating a new instance of that Cipher and initializing it.
key
- the encryption keycipherParams
- the cipher parameters
java.security.InvalidKeyException
- if the given key is inappropriate for initializing this
block cipher.
java.security.InvalidAlgorithmParameterException
- if the parameters are inappropriate for initializing this
block cipher.public abstract java.lang.String getName()
public abstract int getBlockSize()
public abstract int getOutputSize(int inputLen)
inputLen
- the input length (in bytes)
public abstract int getKeySize(java.security.Key key) throws java.security.InvalidKeyException
key
- the key object
java.security.InvalidKeyException
- if key is invalid.public abstract java.security.spec.AlgorithmParameterSpec getParameters()
public abstract byte[] getIV()
protected abstract void setMode(java.lang.String mode) throws java.security.NoSuchAlgorithmException
mode
- the cipher mode
NoSuchModeException
- if the requested mode cannot be found.
java.security.NoSuchAlgorithmException
protected abstract void setPadding(java.lang.String padding) throws javax.crypto.NoSuchPaddingException
padding
- the padding mechanism
javax.crypto.NoSuchPaddingException
- if the requested padding scheme cannot be found.public final byte[] update(byte[] input)
input
- the input buffer
public abstract byte[] update(byte[] input, int inOff, int inLen)
input
- the input bufferinOff
- the offset where the input startsinLen
- the input length
public abstract int update(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException
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 final byte[] doFinal() throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
- if this cipher is a block cipher and the total input
length is not a multiple of the block size (for
encryption when no padding is used or for decryption).
javax.crypto.BadPaddingException
- if this cipher is a block cipher and unpadding fails.public final byte[] doFinal(byte[] input) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
input
- the input buffer
javax.crypto.IllegalBlockSizeException
- if this cipher is a block cipher and the total input
length is not a multiple of the block size (for
encryption when no padding is used or for decryption).
javax.crypto.BadPaddingException
- if this cipher is a block cipher and unpadding fails.public abstract byte[] doFinal(byte[] input, int inOff, int inLen) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
input
- the input bufferinOff
- the offset where the input startsinLen
- the input length
javax.crypto.IllegalBlockSizeException
- if this cipher is a block cipher and the total input
length is not a multiple of the block size (for
encryption when no padding is used or for decryption).
javax.crypto.BadPaddingException
- if this cipher is a block cipher and unpadding fails.public abstract int doFinal(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws javax.crypto.ShortBufferException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
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.IllegalBlockSizeException
- if this cipher is a block cipher and the total input
length is not a multiple of the block size (for
encryption when no padding is used or for decryption).
javax.crypto.BadPaddingException
- if this cipher is a block cipher and unpadding fails.
|
Bouncy Castle Cryptography Library 1.48 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |