com.continuent.tungsten.common.security
Class Encryptor

java.lang.Object
  extended by com.continuent.tungsten.common.security.Encryptor

public class Encryptor
extends java.lang.Object

Utility class to cipher / uncipher critical information based on public / private key encryption

Version:
1.0
Author:
Ludovic Launer

Constructor Summary
Encryptor(AuthenticationInfo authenticationInfo)
          Creates a new Encryptor object
 
Method Summary
 java.lang.String decrypt(java.lang.String encryptedMessage)
          Decrypt a String using private key located in KeyStore.
 java.lang.String encrypt(java.lang.String message)
          Encrypt a String using public key located in truststore.
 java.security.KeyPair getKeys(java.lang.String storeLocation, java.lang.String storePassword)
          Retrieve public and/or private keys from Keystore/Strustore Uses the first Alias found in the keystore
 java.security.PrivateKey getPrivateKey_from_KeyStore()
          Get the Public and Private key from a KeyStore
 java.security.PublicKey getPublicKey_from_Truststore()
          Get the Public key from a TrustStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encryptor

public Encryptor(AuthenticationInfo authenticationInfo)
          throws ServerRuntimeException,
                 ConfigurationException
Creates a new Encryptor object

Parameters:
authenticationInfo -
Throws:
ConfigurationException
ServerRuntimeException
Method Detail

getKeys

public java.security.KeyPair getKeys(java.lang.String storeLocation,
                                     java.lang.String storePassword)
Retrieve public and/or private keys from Keystore/Strustore Uses the first Alias found in the keystore

Returns:
KeyPair

getPublicKey_from_Truststore

public java.security.PublicKey getPublicKey_from_Truststore()
Get the Public key from a TrustStore

Returns:
Public key from the Truststore

getPrivateKey_from_KeyStore

public java.security.PrivateKey getPrivateKey_from_KeyStore()
Get the Public and Private key from a KeyStore

Returns:
PrivateKey extracted from the Keystore

encrypt

public java.lang.String encrypt(java.lang.String message)
Encrypt a String using public key located in truststore.

Parameters:
message - to be encrypted
Returns:
Base64 encoded and encryoted message

decrypt

public java.lang.String decrypt(java.lang.String encryptedMessage)
                         throws ConfigurationException
Decrypt a String using private key located in KeyStore.

Parameters:
encryptedMessage -
Returns:
Decrypted String
Throws:
ConfigurationException