public final class KeyWrapAlgorithmImplAES extends java.lang.Object implements KeyWrapAlgorithm
KeyWrapAlgorithm interface, so the Toolkit's
AES key wrap implementation is made available for XML encryption.
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] bytesToBeUnwrapped)
Unwraps (decrypts) wrapped key data.
|
byte[] |
encrypt(byte[] bytesToBeWrapped)
Wraps (encrypts) key data.
|
byte[] |
getEncoded()
Retrieves the encoded key encryption key associated with this
KeyWrapAlgorithm. |
java.lang.String |
getIVparameters()
Returns
null because there is no IV generated for
this algorithm. |
URI |
getURI()
Retrieves the algorithm identifier, which is a
URI. |
void |
initDecrypt(byte[] keyBytes,
byte[] iv)
Initializes the symmetric cipher for unwrapping key data.
|
void |
initEncrypt()
Initializes the symmetric cipher for wrapping key data.
|
void |
setPrivateKey(java.security.PrivateKey decryptionKey)
Required to implement the
EncryptionAlgorithm interface,
but does nothing, since AES Key Wrap is a symmetric algorithm. |
void |
setPublicKey(java.security.PublicKey encryptionKey)
Required to implement the
EncryptionAlgorithm interface,
but does nothing, since AES Key Wrap is a symmetric algorithm. |
void |
setSecretKey(javax.crypto.SecretKey secretKey)
Sets a secret key to wrap or unwrap an <EncryptedKey> element.
|
void |
setURI(URI uri)
Sets the algorithm identifier, which is a
URI. |
public URI getURI()
URI.
getURI in interface EncryptionAlgorithmXMLEConstants.ALGORITHM_AES_256_KEY_WRAP,
XMLEConstants.ALGORITHM_AES_192_KEY_WRAP,
XMLEConstants.ALGORITHM_AES_128_KEY_WRAPpublic void setURI(URI uri)
URI.
setURI in interface EncryptionAlgorithmuri - a URI reference that identifies the algorithmXMLEConstants.ALGORITHM_AES_256_KEY_WRAP,
XMLEConstants.ALGORITHM_AES_192_KEY_WRAP,
XMLEConstants.ALGORITHM_AES_128_KEY_WRAPpublic byte[] getEncoded()
KeyWrapAlgorithm.
getEncoded in interface EncryptionAlgorithmKeyWrapAlgorithmpublic java.lang.String getIVparameters()
null because there is no IV generated for
this algorithm.
getIVparameters in interface EncryptionAlgorithmnullpublic void initEncrypt()
throws EncryptionAlgorithmException
Uses the application provided key encryption key.
initEncrypt in interface EncryptionAlgorithmEncryptionAlgorithmException - if an error occurs during initializationpublic void initDecrypt(byte[] keyBytes,
byte[] iv)
throws EncryptionAlgorithmException
Uses the application-provided key encryption key. The parameters
keyBytes and iv are ignored.
initDecrypt in interface EncryptionAlgorithmkeyBytes - the key material for a secret keyiv - initialization vector to be used in the decryption operationEncryptionAlgorithmException - if an error occurs during initializationinitEncrypt()public byte[] encrypt(byte[] bytesToBeWrapped)
throws EncryptionAlgorithmException
encrypt in interface EncryptionAlgorithmbytesToBeWrapped - the key data to be wrappedEncryptionAlgorithmException - if an error occurs during wrappingpublic byte[] decrypt(byte[] bytesToBeUnwrapped)
throws EncryptionAlgorithmException
decrypt in interface EncryptionAlgorithmbytesToBeUnwrapped - the wrapped key data to be unwrappedEncryptionAlgorithmException - if an error occurs during unwrappingpublic void setSecretKey(javax.crypto.SecretKey secretKey)
throws EncryptionAlgorithmException
setSecretKey in interface KeyWrapAlgorithmsecretKey - the secret key to be used for wrapping or unwrapingEncryptionAlgorithmExceptionpublic void setPrivateKey(java.security.PrivateKey decryptionKey)
throws EncryptionAlgorithmException
EncryptionAlgorithm interface,
but does nothing, since AES Key Wrap is a symmetric algorithm.
setPrivateKey in interface EncryptionAlgorithmdecryptionKey - the private decryption keyEncryptionAlgorithmExceptionPrivateKeypublic void setPublicKey(java.security.PublicKey encryptionKey)
throws EncryptionAlgorithmException
EncryptionAlgorithm interface,
but does nothing, since AES Key Wrap is a symmetric algorithm.
setPublicKey in interface EncryptionAlgorithmEncryptionAlgorithmExceptionPublicKey