java.lang.Object | ||
↳ | javax.crypto.CipherSpi | |
↳ | com.sun.crypto.provider.AESWrapCipher |
This class implements the AES KeyWrap algorithm as defined
in
"XML Encryption Syntax and Processing" section 5.6.3 "AES Key Wrap".
Note: only ECB
mode and NoPadding
padding
can be used for this algorithm.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an instance of AES 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).
| |||||||||||
Returns the initialization vector (IV) which is null for this cipher.
| |||||||||||
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 which is always null
for 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 AES KeyWrap cipher with default mode, i.e. "ECB" 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.
input | the input buffer |
---|---|
inputOffset | the offset in input where the input
starts |
inputLen | 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.
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 ofset in out where the result
is stored. |
IllegalStateException | upon invocation of this method. |
---|---|
BadPaddingException | |
IllegalBlockSizeException | |
ShortBufferException |
Returns the block size (in bytes). i.e. 16 bytes.
Returns the initialization vector (IV) which is null for this cipher.
Returns the key size of the given key object in number of bits.
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 which is always null for this cipher.
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.
opmode | the operation mode of this cipher. Only
WRAP_MODE or UNWRAP_MODE ) are accepted. |
---|---|
key | the secret key. |
params | the algorithm parameters; must be null for this cipher. |
random | the source of randomness. |
InvalidKeyException | if the given key is inappropriate. |
---|---|
InvalidAlgorithmParameterException | if the given algorithm parameters is not null. |
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.
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 for initializing this cipher. |
---|
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.
opmode | the operation mode of this cipher. Only
WRAP_MODE or UNWRAP_MODE ) are accepted. |
---|---|
key | the secret key. |
params | the algorithm parameters; must be null for this cipher. |
random | the source of randomness. |
InvalidKeyException | if the given key is inappropriate for initializing this cipher |
---|---|
InvalidAlgorithmParameterException | if the given algorithm parameters is not null. |
Sets the mode of this cipher. Only "ECB" mode is accepted for this cipher.
mode | the cipher mode |
---|
NoSuchAlgorithmException | if the requested cipher mode is not "ECB". |
---|
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). |