public final class EncryptionAlgorithmImpl3DES extends java.lang.Object implements EncryptionAlgorithm
EncryptionAlgorithm interface,
making the Toolkit's Triple DES implementation available for use in
XML encryption.| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] bytesToBeDecrypted)
Decrypts a byte array.
|
byte[] |
encrypt(byte[] bytesToBeEncrypted)
Encrypts a byte array.
|
byte[] |
getEncoded()
Retrieves the encoded secret key associated with this
EncryptionAlgorithm instance. |
java.lang.String |
getIVparameters()
Retrieves a Base 64 encoding of the initialization vector that was
used at the most recent invocation of
initEncrypt() or
initDecrypt(). |
URI |
getURI()
Gets the algorithm identifier, which is a
URI. |
void |
initDecrypt(byte[] keyBytes,
byte[] iv)
Initializes this symmetric cipher for decrypting, using the key
material and initialization vector provided.
|
void |
initEncrypt()
Initializes the symmetric cipher for encryption using Triple DES.
|
void |
setPrivateKey(java.security.PrivateKey decryptionKey)
This method is required to implement the
EncryptionAlgorithm
interface, but it applies only to asymmetric ciphers, so this
method does nothing. |
void |
setPublicKey(java.security.PublicKey encryptionKey)
This method is required to implement the
EncryptionAlgorithm
interface, but it applies only to asymmetric ciphers, so this
method does nothing. |
void |
setURI(URI uri)
Sets the algorithm identifier, which is a
URI. |
public void initEncrypt()
throws EncryptionAlgorithmException
Generates a random secret key the first time it is invoked, and generates a fresh IV on each subsequent invocation.
initEncrypt in interface EncryptionAlgorithmEncryptionAlgorithmExceptionpublic void initDecrypt(byte[] keyBytes,
byte[] iv)
throws EncryptionAlgorithmException
If the secret key has been initialized already, the invocation does not change it, but the initialization vector is always updated to the value provided.
initDecrypt in interface EncryptionAlgorithmkeyBytes - key material from which a DESedeKeySpec key
specification can be constructediv - an initialization vectorEncryptionAlgorithmExceptioninitEncrypt()public void setPrivateKey(java.security.PrivateKey decryptionKey)
throws EncryptionAlgorithmException
EncryptionAlgorithm
interface, but it applies only to asymmetric ciphers, so this
method does nothing.setPrivateKey in interface EncryptionAlgorithmdecryptionKey - not usedEncryptionAlgorithmExceptionPrivateKeypublic void setPublicKey(java.security.PublicKey encryptionKey)
EncryptionAlgorithm
interface, but it applies only to asymmetric ciphers, so this
method does nothing.setPublicKey in interface EncryptionAlgorithmencryptionKey - not usedPublicKeypublic byte[] getEncoded()
EncryptionAlgorithm instance.getEncoded in interface EncryptionAlgorithmSecretKey associated
with this EncryptionAlgorithm.public URI getURI()
URI.getURI in interface EncryptionAlgorithmXMLEConstants.ALGORITHM_3DESpublic void setURI(URI uri)
URI.setURI in interface EncryptionAlgorithmuri - a URI reference that identifies the algorithmXMLEConstants.ALGORITHM_3DESpublic java.lang.String getIVparameters()
throws EncryptionAlgorithmException
initEncrypt() or
initDecrypt().getIVparameters in interface EncryptionAlgorithmString containing the initialization vectorEncryptionAlgorithmException - if the Base 64 encoding failspublic byte[] decrypt(byte[] bytesToBeDecrypted)
throws EncryptionAlgorithmException
decrypt in interface EncryptionAlgorithmbytesToBeDecrypted - a byte[] containing data to be decryptedbyte[] that contains the decrypted plaintext.EncryptionAlgorithmExceptionpublic byte[] encrypt(byte[] bytesToBeEncrypted)
throws EncryptionAlgorithmException
encrypt in interface EncryptionAlgorithmbytesToBeEncrypted - a byte[] containing plaintext to be encryptedbyte[] that contains the encryption of the plaintext.EncryptionAlgorithmException