Note
only CBC mode and NoPadding padding
scheme can be used for this algorithm.
DESedeCipher
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final FeedbackCipher | |
| private Key | |
| private boolean | |
| private byte[] | |
| private static final byte[] | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | DESedeWrapCipher()
Creates an instance of CMS DESede KeyWrap cipher with default mode, i.e. "CBC" and padding scheme, i.e. "NoPadding". |
| Modifier and Type | Method and Description |
|---|---|
| protected byte[] | Returns: the new buffer with the result.the input buffer. in, int the offset in inOffset, int in where the input
starts.the input length. inLen)Implements abstract javax. This operation is not supported by this cipher. |
| protected int | Returns: the number of bytes stored inout.the input buffer. input, int the offset in inputOffset, int input where the input
starts.the input length. inputLen, byte[] the buffer for the result. output, int the ofset in outputOffset)output where the result
is stored.Implements abstract javax. This operation is not supported by this cipher. |
| protected int | Returns: the block size (in bytes), i.e. 8 bytes.Implements abstract javax. Returns the block size (in bytes), i.e. 8 bytes. |
| protected byte[] | Returns: the initialization vector, or null if the underlying algorithm does not use an IV, or if the IV has not yet been set.Implements abstract javax. Returns the initialization vector (IV) in a new buffer. |
| protected int | Returns: the "effective" key size of the given key object.the key object. key)Overrides javax. Returns the key size of the given key object in number of bits. |
| protected int | Returns: the required output buffer size (in bytes).the input length (in bytes). inputLen)Implements abstract javax. Returns the length in bytes that an output buffer would need to be
given the input length |
| protected AlgorithmParameters | Returns: the parameters used with this cipher; can be null.Implements abstract javax. Returns the parameters used with this cipher. |
| protected void | engineInit(int
the operation mode of this cipher. Only
opmode, Key WRAP_MODE or UNWRAP_MODE) are accepted.the secret key. key, SecureRandom the source of randomness. random)Implements abstract javax. Initializes this cipher with a key and a source of randomness. |
| protected void | engineInit(int
the operation mode of this cipher. Only
opmode, Key WRAP_MODE or UNWRAP_MODE) are accepted.the secret key. key, AlgorithmParameterSpec the algorithm parameters. params, SecureRandom the source of randomness. random)Implements abstract javax. Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. |
| protected void | engineInit(int
the operation mode of this cipher. Only
opmode, Key WRAP_MODE or UNWRAP_MODE) are accepted.the secret key. key, AlgorithmParameters the algorithm parameters. params, SecureRandom the source of randomness. random)Implements abstract javax. Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. |
| protected void | engineSetMode(String
the cipher mode. mode)Implements abstract javax. Sets the mode of this cipher. |
| protected void | engineSetPadding(String
the padding mechanism. padding)Implements abstract javax. Sets the padding mechanism of this cipher. |
| protected Key | Returns: the unwrapped key.the key to be unwrapped. wrappedKey, String the algorithm the wrapped key is for. wrappedKeyAlgorithm, int the type of the wrapped key.
This is one of wrappedKeyType)Cipher.SECRET_KEY,
Cipher.PRIVATE_KEY, or Cipher.PUBLIC_KEY.Overrides javax. Unwrap a previously wrapped key. |
| protected byte[] | Returns: n/a.the input buffer. in, int the offset in inOffset, int in where the input
starts.the input length. inLen)Implements abstract javax. This operation is not supported by this cipher. |
| protected int | Returns: n/a.the input buffer. in, int the offset in inOffset, int in where the input
starts.the input length. inLen, byte[] the buffer for the result. out, int the offset in outOffset)out where the result
is stored.Implements abstract javax. This operation is not supported by this cipher. |
| protected byte[] | Returns: the wrapped key.the key to be wrapped. key)Overrides javax. Wrap a key. |
| private static final byte[] | |
| private static final byte[] |
| CHECKSUM_LEN | back to summary |
|---|---|
| private static final int CHECKSUM_LEN | |
| cipher | back to summary |
|---|---|
| private final FeedbackCipher cipher | |
| cipherKey | back to summary |
|---|---|
| private Key cipherKey | |
| decrypting | back to summary |
|---|---|
| private boolean decrypting | |
| iv | back to summary |
|---|---|
| private byte[] iv | |
| IV2 | back to summary |
|---|---|
| private static final byte[] IV2 | |
| IV_LEN | back to summary |
|---|---|
| private static final int IV_LEN | |
| DESedeWrapCipher | back to summary |
|---|---|
| public DESedeWrapCipher() Creates an instance of CMS DESede KeyWrap cipher with default mode, i.e. "CBC" and padding scheme, i.e. "NoPadding". | |
| engineDoFinal | back to summary |
|---|---|
| protected byte[] engineDoFinal(byte[] in, int inOffset, int inLen) throws IllegalBlockSizeException, BadPaddingException Implements abstract javax. This operation is not supported by this cipher. Since it's impossible to initialize this cipher given the current Cipher.engineInit(...) implementation, IllegalStateException will always be thrown upon invocation.
| |
| engineDoFinal | back to summary |
|---|---|
| protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws IllegalBlockSizeException, ShortBufferException, BadPaddingException Implements abstract javax. This operation is not supported by this cipher. Since it's impossible to initialize this cipher given the current Cipher.engineInit(...) implementation, IllegalStateException will always be thrown upon invocation.
| |
| engineGetBlockSize | back to summary |
|---|---|
| protected int engineGetBlockSize() Implements abstract javax. Returns the block size (in bytes), i.e. 8 bytes.
| |
| engineGetIV | back to summary |
|---|---|
| protected byte[] engineGetIV() Implements abstract javax. Returns the initialization vector (IV) in a new buffer.
| |
| engineGetKeySize | back to summary |
|---|---|
| protected int engineGetKeySize(Key key) throws InvalidKeyException Overrides javax. Returns the key size of the given key object in number of bits. This cipher always return the same key size as the DESede ciphers.
| |
| engineGetOutputSize | back to summary |
|---|---|
| protected int engineGetOutputSize(int inputLen) Implements abstract javax. Returns the length in bytes that an output buffer would need to be
given the input length The actual output length of the next
| |
| engineGetParameters | back to summary |
|---|---|
| protected AlgorithmParameters engineGetParameters() Implements abstract javax. Returns the parameters used with this cipher. Note that null maybe returned if this cipher does not use any parameters or when it has not been set, e.g. initialized with UNWRAP_MODE but wrapped key data has not been given.
| |
| engineInit | back to summary |
|---|---|
| protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException Implements abstract javax. Initializes this cipher with a key and a source of randomness. The cipher only supports the following two operation modes:
For modes other than the above two, UnsupportedOperationException will be thrown. If this cipher requires an initialization vector (IV), it will get
it from
| |
| engineInit | back to summary |
|---|---|
| protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException Implements abstract javax. Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. The cipher only supports the following two operation modes:
For modes other than the above two, UnsupportedOperationException will be thrown. If this cipher requires an initialization vector (IV), it will get
it from
| |
| engineInit | back to summary |
|---|---|
| protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException Implements abstract javax. Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. The cipher only supports the following two operation modes:
For modes other than the above two, UnsupportedOperationException will be thrown. If this cipher requires an initialization vector (IV), it will get
it from
| |
| engineSetMode | back to summary |
|---|---|
| protected void engineSetMode(String mode) throws NoSuchAlgorithmException Implements abstract javax. Sets the mode of this cipher. Only "CBC" mode is accepted for this cipher.
| |
| engineSetPadding | back to summary |
|---|---|
| protected void engineSetPadding(String padding) throws NoSuchPaddingException Implements abstract javax. Sets the padding mechanism of this cipher. Only "NoPadding" schmem is accepted for this cipher.
| |
| engineUnwrap | back to summary |
|---|---|
| protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException Overrides javax. Unwrap a previously wrapped key.
| |
| engineUpdate | back to summary |
|---|---|
| protected byte[] engineUpdate(byte[] in, int inOffset, int inLen) Implements abstract javax. This operation is not supported by this cipher. Since it's impossible to initialize this cipher given the current Cipher.engineInit(...) implementation, IllegalStateException will always be thrown upon invocation.
| |
| engineUpdate | back to summary |
|---|---|
| protected int engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset) throws ShortBufferException Implements abstract javax. This operation is not supported by this cipher. Since it's impossible to initialize this cipher given the current Cipher.engineInit(...) implementation, IllegalStateException will always be thrown upon invocation.
| |
| engineWrap | back to summary |
|---|---|
| protected byte[] engineWrap(Key key) throws IllegalBlockSizeException, InvalidKeyException Overrides javax. Wrap a key.
| |
| getChecksum | back to summary |
|---|---|
| private static final byte[] getChecksum(byte[] in) | |
| getChecksum | back to summary |
|---|---|
| private static final byte[] getChecksum(byte[] in, int offset, int len) | |