com.metamatrix.common.util.crypto
Class PasswordChangeUtility

java.lang.Object
  extended by com.metamatrix.common.util.crypto.PasswordChangeUtility

public class PasswordChangeUtility
extends java.lang.Object

Utility that allows ciphertext that was encrypted with one key to be decrypted with the old key and re-encrypted with a new key

This utility assumes that the keys have been created and verified to work correctly.


Field Summary
protected  boolean initialized
          Initailization state.
protected  Cryptor newCryptor
          The Cryptor to use for encrypting the new passwords.
protected  Cryptor oldCryptor
          The Cryptor to use for decrypting the old passwords.
 
Constructor Summary
PasswordChangeUtility(java.lang.String oldkeyFileName, java.lang.String newkeyFileName)
          Construct a PasswordChangeUtility with information for two different keys.
 
Method Summary
 void init()
          Initialize this factory, bound to a specific key and key entry in that store.
 java.lang.String newDecrypt(java.lang.String ciphertext)
          Use new Cryptor to decrypt a char[].
 java.util.Properties newDecrypt(java.lang.String match, java.util.Properties props)
          Use new Cryptor to decrypt properties.
 java.lang.String newEncrypt(java.lang.String cleartext)
          Use new Cryptor to encrypt a char[].
 java.util.Properties newEncrypt(java.lang.String match, java.util.Properties props)
          Use new Cryptor to encrypt properties.
 java.lang.String oldDecrypt(java.lang.String ciphertext)
          Use old Cryptor to decrypt a char[].
 java.util.Properties oldDecrypt(java.lang.String match, java.util.Properties props)
          Use old Cryptor to decrypt properties.
 java.lang.String oldEncrypt(java.lang.String cleartext)
          Use old Cryptor to encrypt a char[].
 java.util.Properties oldEncrypt(java.lang.String match, java.util.Properties props)
          Use old Cryptor to encrypt properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected boolean initialized
Initailization state.


oldCryptor

protected Cryptor oldCryptor
The Cryptor to use for decrypting the old passwords.


newCryptor

protected Cryptor newCryptor
The Cryptor to use for encrypting the new passwords.

Constructor Detail

PasswordChangeUtility

public PasswordChangeUtility(java.lang.String oldkeyFileName,
                             java.lang.String newkeyFileName)
Construct a PasswordChangeUtility with information for two different keys.

Parameters:
oldkeyFileName - The absolute path to the key with which you would like to decrypt the old passwords.
newkeyFileName - The absolute path to the key with which you would like to encrypt the new passwords.
Throws:
IllegaArgumentException - if any arguments are null or empty.
Method Detail

init

public void init()
          throws CryptoException

Initialize this factory, bound to a specific key and key entry in that store.

Throws:
CryptoException

oldEncrypt

public java.lang.String oldEncrypt(java.lang.String cleartext)
                            throws CryptoException
Use old Cryptor to encrypt a char[].

Parameters:
cleartext - The cleartext that you want encrypted with the old Cryptor.
Returns:
The encrypted ciphertext chars.
Throws:
CryptoException - If an error occurs durring initialization of the Cryptor or during encryption.

oldEncrypt

public java.util.Properties oldEncrypt(java.lang.String match,
                                       java.util.Properties props)
                                throws CryptoException
Use old Cryptor to encrypt properties. Encrypts any properties that end with match

Parameters:
match -
props -
Returns:
Encrypted properties
Throws:
CryptoException
Since:
4.3

oldDecrypt

public java.lang.String oldDecrypt(java.lang.String ciphertext)
                            throws CryptoException
Use old Cryptor to decrypt a char[].

Parameters:
ciphertext - The ciphertext that you want decrypted with the old Cryptor.
Returns:
The decrypted cleartext chars.
Throws:
CryptoException - If an error occurs durring initialization of the Cryptor or during decryption.

oldDecrypt

public java.util.Properties oldDecrypt(java.lang.String match,
                                       java.util.Properties props)
                                throws CryptoException
Use old Cryptor to decrypt properties. Decrypts any properties that end with match

Parameters:
match -
props -
Returns:
decrypted properties
Throws:
CryptoException
Since:
4.3

newEncrypt

public java.lang.String newEncrypt(java.lang.String cleartext)
                            throws CryptoException
Use new Cryptor to encrypt a char[].

Parameters:
cleartext - The cleartext that you want encrypted with the new Cryptor.
Returns:
The encrypted ciphertext chars.
Throws:
CryptoException - If an error occurs durring initialization of the Cryptor or during encryption.

newEncrypt

public java.util.Properties newEncrypt(java.lang.String match,
                                       java.util.Properties props)
                                throws CryptoException
Use new Cryptor to encrypt properties. Encrypts any properties that end with match

Parameters:
match -
props -
Returns:
encrypted properties
Throws:
CryptoException
Since:
4.3

newDecrypt

public java.lang.String newDecrypt(java.lang.String ciphertext)
                            throws CryptoException
Use new Cryptor to decrypt a char[].

Parameters:
ciphertext - The ciphertext that you want decrypted with the new Cryptor.
Returns:
The decrypted cleartext chars.
Throws:
CryptoException - If an error occurs durring initialization of the Cryptor or during decryption.

newDecrypt

public java.util.Properties newDecrypt(java.lang.String match,
                                       java.util.Properties props)
                                throws CryptoException
Use new Cryptor to decrypt properties. Decrypts any properties that end with match

Parameters:
match -
props -
Returns:
decrypted properties
Throws:
CryptoException
Since:
4.3


Copyright © 2009. All Rights Reserved.