com.ibm.di.plugin.idipwsync
Class IDIPasswordCrypto

java.lang.Object
  extended by com.ibm.di.plugin.idipwsync.IDIPasswordCrypto

public class IDIPasswordCrypto
extends Object


Constructor Summary
IDIPasswordCrypto()
           
 
Method Summary
static String decrypt(String cipherText, String ksPath, String ksPassword, String certificateAlias)
          decrypt: Obtain plain ascii text for encrypted ciphertext specified.
static String decrypt(String cipherText, String ksPath, String ksPassword, String certificateAlias, String certificatePassword)
          decrypt: Obtain plain ascii text for encrypted ciphertext specified.
static String encrypt(String plainText, String ksPath, String ksPassword, String certificateAlias)
          encrypt: Obtain encrypted (and ascii-encoded) value for plaintext specified, null strings are not processed and will be returned as null.
static String getProviderInfo()
          getProviderInfo: Returns String value of provider information
static void main(String[] argv)
          Provided to demonstrate use of public static methods usage IDIPasswordCrypto testvalue keystorePath keystorePassword certificateAlias.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDIPasswordCrypto

public IDIPasswordCrypto()
Method Detail

getProviderInfo

public static String getProviderInfo()
                              throws Exception
getProviderInfo: Returns String value of provider information

Returns:
String representing values of instance variables, null returned if error
Throws:
Exception - When unable to add provider

encrypt

public static String encrypt(String plainText,
                             String ksPath,
                             String ksPassword,
                             String certificateAlias)
                      throws Exception
encrypt: Obtain encrypted (and ascii-encoded) value for plaintext specified, null strings are not processed and will be returned as null.

Parameters:
plainText - String representing value to be encrypted
ksPath - String representing file path to jks file
ksPassword - String representing password for jks file as specified by path
certificateAlias - String naming the alias of certificate in keystore file
Returns:
String representing encrypted format, null is returned if a null is passed in.
Throws:
java.langException - when underlying funtion fails
Exception

decrypt

public static String decrypt(String cipherText,
                             String ksPath,
                             String ksPassword,
                             String certificateAlias,
                             String certificatePassword)
                      throws Exception
decrypt: Obtain plain ascii text for encrypted ciphertext specified. Null strings are not processed and will be returned as received. Empty strings will be encoded/encrypted.

Parameters:
cipherText - String representing value to be decrypted
ksPath - String representing file path to jks file
ksPassword - String representing password for jks file as specified by path
certificateAlias - String naming the alias of certificate in keystore file
certificatePassword - String representing password for the certificate's private key
Returns:
String representing the decrypted format of the received string. Null is returned when a null is received.
Throws:
java.langException - when underlying funtion fails
Exception

decrypt

public static String decrypt(String cipherText,
                             String ksPath,
                             String ksPassword,
                             String certificateAlias)
                      throws Exception
decrypt: Obtain plain ascii text for encrypted ciphertext specified. This method uses the same password for the keystore file and for accessing the private key. Null strings are not processed and will be returned as received. Empty strings will be encoded/encrypted.

Parameters:
cipherText - String representing value to be decrypted
ksPath - String representing file path to jks file
ksPassword - String representing password for jks file as specified by path
certificateAlias - String naming the alias of certificate in keystore file
Returns:
String representing the decrypted format of the received string. Null is returned when a null is received.
Throws:
java.langException - when underlying funtion fails
Exception

main

public static void main(String[] argv)
Provided to demonstrate use of public static methods usage IDIPasswordCrypto testvalue keystorePath keystorePassword certificateAlias. testvalue is a String to be encrypted, decrypted and verified. keystorePath is a String naming the location of the keystore (jks) file which contains keys and certificates. keystorePassword is a a String representing the password for accessng the keystore file. certificateAlias is a String naming the certificate to be used for obtaining the keys.

Parameters:
argv -