java.lang.Object | ||
↳ | javax.crypto.CipherSpi | |
↳ | com.sun.crypto.provider.DESedeWrapCipher |
This class implements the CMS DESede KeyWrap algorithm as defined
in
"XML Encryption Syntax and Processing" section 5.6.2
"CMS Triple DES Key Wrap".
Note: only CBC
mode and NoPadding
padding
scheme can be used for this algorithm.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an instance of CMS DESede KeyWrap cipher with default
mode, i.e.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This operation is not supported by this cipher.
| |||||||||||
This operation is not supported by this cipher.
| |||||||||||
Returns the block size (in bytes), i.e.
| |||||||||||
Returns the initialization vector (IV) in a new buffer.
| |||||||||||
Returns the key size of the given key object in number of bits.
| |||||||||||
Returns the length in bytes that an output buffer would need to be
given the input length
inputLen (in bytes). | |||||||||||
Returns the parameters used with this cipher.
| |||||||||||
Initializes this cipher with a key, a set of algorithm parameters,
and a source of randomness.
| |||||||||||
Initializes this cipher with a key and a source of randomness.
| |||||||||||
Initializes this cipher with a key, a set of algorithm parameters,
and a source of randomness.
| |||||||||||
Sets the mode of this cipher.
| |||||||||||
Sets the padding mechanism of this cipher.
| |||||||||||
Unwrap a previously wrapped key.
| |||||||||||
This operation is not supported by this cipher.
| |||||||||||
This operation is not supported by this cipher.
| |||||||||||
Wrap a key.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates an instance of CMS DESede KeyWrap cipher with default mode, i.e. "CBC" and padding scheme, i.e. "NoPadding".
SecurityException | if this constructor fails to verify its own integrity. |
---|
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.
in | the input buffer. |
---|---|
inOffset | the offset in in where the input
starts. |
inLen | the input length. |
IllegalStateException | upon invocation of this method. |
---|---|
BadPaddingException | |
IllegalBlockSizeException |
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.
input | the input buffer |
---|---|
inputOffset | the offset in input where the input
starts |
inputLen | the input length |
output | the buffer for the result |
outputOffset | the offset in output where the result
is stored |
out
.IllegalStateException | upon invocation of this method. |
---|---|
BadPaddingException | |
IllegalBlockSizeException | |
ShortBufferException |
Returns the block size (in bytes), i.e. 8 bytes.
Returns the initialization vector (IV) in a new buffer.
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.
key | the key object. |
---|
InvalidKeyException | if key is invalid.
|
---|
Returns the length in bytes that an output buffer would need to be
given the input length inputLen
(in bytes).
The actual output length of the next update
or
doFinal
call may be smaller than the length returned
by this method.
inputLen | the input length (in bytes). |
---|
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 be set, e.g. initialized with UNWRAP_MODE but wrapped key data has not been given.
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: Cipher.WRAP_MODE, and Cipher.UNWRAP_MODE.
For modes other than the above two, UnsupportedOperationException will be thrown.
If this cipher requires an initialization vector (IV), it will get
it from random
.
opmode | the operation mode of this cipher. Only
WRAP_MODE or UNWRAP_MODE ) are accepted. |
---|---|
key | the secret key. |
params | the algorithm parameters. |
random | the source of randomness. |
InvalidKeyException | if the given key is inappropriate. |
---|---|
InvalidAlgorithmParameterException | if the given algorithm parameters are inappropriate for this cipher. |
Initializes this cipher with a key and a source of randomness.
The cipher only supports the following two operation modes: Cipher.WRAP_MODE, and Cipher.UNWRAP_MODE.
For modes other than the above two, UnsupportedOperationException will be thrown.
If this cipher requires an initialization vector (IV), it will get
it from random
.
opmode | the operation mode of this cipher. Only
WRAP_MODE or UNWRAP_MODE ) are accepted. |
---|---|
key | the secret key. |
random | the source of randomness. |
InvalidKeyException | if the given key is inappropriate or if parameters are required but not supplied. |
---|
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: Cipher.WRAP_MODE, and Cipher.UNWRAP_MODE.
For modes other than the above two, UnsupportedOperationException will be thrown.
If this cipher requires an initialization vector (IV), it will get
it from random
.
opmode | the operation mode of this cipher. Only
WRAP_MODE or UNWRAP_MODE ) are accepted. |
---|---|
key | the secret key. |
params | the algorithm parameters. |
random | the source of randomness. |
InvalidKeyException | if the given key is inappropriate. |
---|---|
InvalidAlgorithmParameterException | if the given algorithm parameters are inappropriate for this cipher. |
Sets the mode of this cipher. Only "CBC" mode is accepted for this cipher.
mode | the cipher mode. |
---|
NoSuchAlgorithmException | if the requested cipher mode is not "CBC". |
---|
Sets the padding mechanism of this cipher. Only "NoPadding" schmem is accepted for this cipher.
padding | the padding mechanism. |
---|
NoSuchPaddingException | if the requested padding mechanism is not "NoPadding". |
---|
Unwrap a previously wrapped key.
wrappedKey | the key to be unwrapped. |
---|---|
wrappedKeyAlgorithm | the algorithm the wrapped key is for. |
wrappedKeyType | the type of the wrapped key.
This is one of Cipher.SECRET_KEY ,
Cipher.PRIVATE_KEY , or Cipher.PUBLIC_KEY . |
NoSuchAlgorithmException | if no installed providers
can create keys of type wrappedKeyType for the
wrappedKeyAlgorithm . |
---|---|
InvalidKeyException | if wrappedKey does not
represent a wrapped key of type wrappedKeyType for
the wrappedKeyAlgorithm .
|
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.
in | the input buffer. |
---|---|
inOffset | the offset in in where the input
starts. |
inLen | the input length. |
out | the buffer for the result. |
outOffset | the offset in out where the result
is stored. |
IllegalStateException | upon invocation of this method. |
---|---|
ShortBufferException |
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.
in | the input buffer. |
---|---|
inOffset | the offset in in where the input
starts. |
inLen | the input length. |
IllegalStateException | upon invocation of this method. |
---|
Wrap a key.
key | the key to be wrapped. |
---|
IllegalBlockSizeException | if this cipher is a block cipher, no padding has been requested, and the length of the encoding of the key to be wrapped is not a multiple of the block size. |
---|---|
InvalidKeyException | if it is impossible or unsafe to wrap the key with this cipher (e.g., a hardware protected key is being passed to a software only cipher). |