public final class EncryptionAlgorithmImplRSA extends java.lang.Object implements EncryptionAlgorithm
EncryptionAlgorithm interface,
making the Toolkit's RSA implementations available for use in XML
encryption.| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] toBeDecrypted)
Decrypts a byte array.
|
byte[] |
encrypt(byte[] toBeEncrypted)
Encrypts a byte array.
|
byte[] |
getEncoded()
This method is required to implement the
EncryptionAlgorithm interface,
but it pertains to symmetric ciphers, so here it does nothing. |
java.lang.String |
getIVparameters()
This method is required to implement the
EncryptionAlgorithm interface,
but asymmetric ciphers have no IV parameters, so this method does nothing. |
URI |
getURI()
Gets the algorithm identifier, which is a
URI. |
void |
initDecrypt(byte[] keyBytes,
byte[] iv)
This method is required to implement the
EncryptionAlgorithm interface,
but it does nothing, since RSA is an asymmetric cipher. |
void |
initEncrypt()
This method is required to implement the
EncryptionAlgorithm interface,
but it does nothing, since RSA is an asymmetric cipher. |
void |
setPrivateKey(java.security.PrivateKey decryptionKey)
Sets the private key to be used for decrypting.
|
void |
setPublicKey(java.security.PublicKey encryptionKey)
Sets the public key to be used for encryption.
|
void |
setURI(URI uri)
Sets the algorithm identifier, which is a
URI. |
public void initEncrypt()
EncryptionAlgorithm interface,
but it does nothing, since RSA is an asymmetric cipher.initEncrypt in interface EncryptionAlgorithmpublic void initDecrypt(byte[] keyBytes,
byte[] iv)
EncryptionAlgorithm interface,
but it does nothing, since RSA is an asymmetric cipher.initDecrypt in interface EncryptionAlgorithmkeyBytes - the key material for a secret keyiv - initialization vector to be used in the decryption operationpublic byte[] getEncoded()
EncryptionAlgorithm interface,
but it pertains to symmetric ciphers, so here it does nothing.getEncoded in interface EncryptionAlgorithmEncryptionAlgorithmpublic URI getURI()
URI.getURI in interface EncryptionAlgorithmXMLEConstants.ALGORITHM_RSA,
XMLEConstants.ALGORITHM_RSA_OAEPpublic void setURI(URI uri) throws EncryptionAlgorithmException
URI.setURI in interface EncryptionAlgorithmuri - a URI reference that identifies the algorithm.EncryptionAlgorithmExceptionXMLEConstants.ALGORITHM_RSA,
XMLEConstants.ALGORITHM_RSA_OAEPpublic java.lang.String getIVparameters()
EncryptionAlgorithm interface,
but asymmetric ciphers have no IV parameters, so this method does nothing.getIVparameters in interface EncryptionAlgorithmnullpublic byte[] decrypt(byte[] toBeDecrypted)
throws EncryptionAlgorithmException
decrypt in interface EncryptionAlgorithmtoBeDecrypted - a byte[] containing data to be decryptedEncryptionAlgorithmExceptionpublic byte[] encrypt(byte[] toBeEncrypted)
throws EncryptionAlgorithmException
encrypt in interface EncryptionAlgorithmtoBeEncrypted - a byte[] containing plaintext to be encryptedEncryptionAlgorithmExceptionpublic void setPrivateKey(java.security.PrivateKey decryptionKey)
throws EncryptionAlgorithmException
setPrivateKey in interface EncryptionAlgorithmdecryptionKey - the private key to be used for decryptingEncryptionAlgorithmExceptionPrivateKeypublic void setPublicKey(java.security.PublicKey encryptionKey)
throws EncryptionAlgorithmException
The key must be an instance of class
java.security.interfaces.RSAPublicKey.
setPublicKey in interface EncryptionAlgorithmencryptionKey - the public key to be used for encryptingEncryptionAlgorithmExceptionPublicKey