Enhydra-Oyster 2.1-7 API

org.enhydra.oyster.crypto
Class AsymmetricEncryption

java.lang.Object
  extended byorg.enhydra.oyster.crypto.AsymmetricEncryption

public class AsymmetricEncryption
extends java.lang.Object

AsymmetricEncryption class is used for asymmetric encryption of the small parts of data (for exsample to encrypt symmetric key genereted in the class SymmetricEncryption). Performed algorithm is RSA/ECB/PKCS1Padding.

In order to create a Cipher object, the application calls the Cipher's getInstance method, and passes the name of the requested transformation to it. The name of a provider may be specified.


Constructor Summary
AsymmetricEncryption()
          Default constructor
 
Method Summary
 void decrypt(java.security.Key key0, byte[] forDecrypt0)
          Perform RSA decryption of the input byte array with the public or private key.
 void encrypt(java.security.Key key0, byte[] forEncrypt0)
          Perform RSA encryption of the input byte array with the private or public key.
 byte[] getDecryptedValue()
          Returns the decrypted value.
 byte[] getEncryptedValue()
          Returns encrypted value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsymmetricEncryption

public AsymmetricEncryption()
Default constructor

Method Detail

encrypt

public void encrypt(java.security.Key key0,
                    byte[] forEncrypt0)
             throws SMIMEException
Perform RSA encryption of the input byte array with the private or public key.

Parameters:
key0 - private or public key
forEncrypt0 - content for encryption
Throws:
SMIMEException - caused by non SMIMEException which can be one of the following: NoSuchPaddingException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException.

getEncryptedValue

public byte[] getEncryptedValue()
Returns encrypted value. To work properly encryption must be first performed.

Returns:
Encrypted value represented as byte array.

decrypt

public void decrypt(java.security.Key key0,
                    byte[] forDecrypt0)
             throws SMIMEException
Perform RSA decryption of the input byte array with the public or private key.

Parameters:
key0 - private or public key
forDecrypt0 - content for decryption
Throws:
SMIMEException - caused by non SMIMEException which can be one of the following: NoSuchPaddingException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException.

getDecryptedValue

public byte[] getDecryptedValue()
Returns the decrypted value. To work properly, decryption must be first performed.

Returns:
Decrypted value represented as byte array.

Enhydra-Oyster 2.1-7 API