Sun Adapter for LDAP API

com.stc.connector.ldapadapter.utils.cryptography.api
Interface Cryptor

All Known Implementing Classes:
CryptorImpl

public interface Cryptor

Provides basic cryptographic functionality such as encryption/decryption etc.

Version:
$Revision: 1.2 $, $Date: 2008/04/23 11:03:15 $
Author:

Field Summary
static java.lang.String CIPHER_KEY_ALIAS_PROPERTY_KEY
          The property key for the name of the alias under the key is stored in the keystore.
static java.lang.String CIPHER_KEY_PASSWORD_PROPERTY_KEY
          The property key for the password under the key is stored in the keystore.
static java.lang.String CIPHER_TRANSFORMATION_PROPERTY_KEY
          The property key for the transformation used by the cipher.
 
Method Summary
 byte[] decodeBase64(byte[] aData)
          Decodes the Base64 encoded aData.
 byte[] decodeBase64AndDecrypt(byte[] aData)
          Decrypts the Base64 encoded aData and then decrypts using the same Cipher that was used to encrypt it.
 byte[] decrypt(byte[] aData)
          Decrypts the aData using a Cipher.
 byte[] encodeBase64(byte[] aData)
          Encodes the aData to Base64 encoded form.
 byte[] encrypt(byte[] aData)
          Encrypts the aData using a Cipher.
 byte[] encryptAndEncodeBase64(byte[] aData)
          Encrypts the aData using a Cipher and returns the results in Base64 encoded form.
 

Field Detail

CIPHER_KEY_ALIAS_PROPERTY_KEY

static final java.lang.String CIPHER_KEY_ALIAS_PROPERTY_KEY
The property key for the name of the alias under the key is stored in the keystore.

See Also:
Constant Field Values

CIPHER_KEY_PASSWORD_PROPERTY_KEY

static final java.lang.String CIPHER_KEY_PASSWORD_PROPERTY_KEY
The property key for the password under the key is stored in the keystore.

See Also:
Constant Field Values

CIPHER_TRANSFORMATION_PROPERTY_KEY

static final java.lang.String CIPHER_TRANSFORMATION_PROPERTY_KEY
The property key for the transformation used by the cipher.

See Also:
Constant Field Values
Method Detail

encrypt

byte[] encrypt(byte[] aData)
Encrypts the aData using a Cipher.

Parameters:
aData - The data to be encrypted.
Returns:
byte[] The encrypted data.
Throws:
java.lang.SecurityException - Thrown when failed to encrypt.

decrypt

byte[] decrypt(byte[] aData)
Decrypts the aData using a Cipher.

Parameters:
aData - The encyrpted data.
Returns:
byte[] The decrypted data.
Throws:
java.lang.SecurityException - Thrown when failed to decrypt.

encodeBase64

byte[] encodeBase64(byte[] aData)
Encodes the aData to Base64 encoded form.

Parameters:
aData - The data to be encoded in Base64.
Returns:
byte[] The encoded data.
Throws:
java.lang.SecurityException - Thrown when failed to encode.

decodeBase64

byte[] decodeBase64(byte[] aData)
Decodes the Base64 encoded aData.

Parameters:
aData - The Base64 encoded data.
Returns:
byte[] The decoded data.
Throws:
java.lang.SecurityException - Thrown when failed to decode.

encryptAndEncodeBase64

byte[] encryptAndEncodeBase64(byte[] aData)
Encrypts the aData using a Cipher and returns the results in Base64 encoded form. It uses methods encrypt and base64Encode in its implementation.

Parameters:
aData - The data to be encrypted.
Returns:
byte[] The encrypted data.
Throws:
java.lang.SecurityException - Thrown when failed to encrypt.

decodeBase64AndDecrypt

byte[] decodeBase64AndDecrypt(byte[] aData)
Decrypts the Base64 encoded aData and then decrypts using the same Cipher that was used to encrypt it. This method will decrypt only the data that was encrypted using the encryptAndBase64Encode method of this interface. It uses methods base64Decode and decrypt in its implementation.

Parameters:
aData - The encyrpted data in Base64 encoded form.
Returns:
byte[] The decrypted data.
Throws:
java.lang.SecurityException - Thrown when failed to decrypt.

Sun Adapter for LDAP API