org.webdocwf.util.smime.crypto
Class AsymmetricEncryption

java.lang.Object
  |
  +--org.webdocwf.util.smime.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 decryption(java.security.Key key0, byte[] forDecrypt0)
          Perform RSA decryption of the input byte array with the public or private key.
 void encryption(java.security.Key key0, byte[] forEncrypt0)
          Perform RSA encryption of the input byte array with the private or public key.
 byte[] getDecryptValue()
          Returns the decrypted value.
 byte[] getEncryptValue()
          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

encryption

public void encryption(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.

getEncryptValue

public byte[] getEncryptValue()
Returns encrypted value. To work properly encryption must be first performed.
Returns:
Encrypted value represented as byte array.

decryption

public void decryption(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.

getDecryptValue

public byte[] getDecryptValue()
Returns the decrypted value. To work properly, decryption must be first performed.
Returns:
Decrypted value represented as byte array.


Copyright © 2002-2002 Together Teamlösungen. All Rights Reserved.