org.wiztools.wizcrypt
Class CipherKeyGen

java.lang.Object
  extended by org.wiztools.wizcrypt.CipherKeyGen

public final class CipherKeyGen
extends java.lang.Object

This class has static methods to create CipherKey objects.

See Also:
CipherKey, WizCrypt

Method Summary
static CipherKey getCipherKeyForDecrypt(java.lang.String keyStr)
          This is the public API used for getting the CipherKey object used in WizCrypt public APIs.
static CipherKey getCipherKeyForEncrypt(java.lang.String keyStr)
          This is the public API used for getting the CipherKey object used in WizCrypt public APIs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCipherKeyForEncrypt

public static CipherKey getCipherKeyForEncrypt(java.lang.String keyStr)
                                        throws java.security.NoSuchAlgorithmException,
                                               java.io.UnsupportedEncodingException,
                                               java.security.InvalidKeyException,
                                               javax.crypto.NoSuchPaddingException
This is the public API used for getting the CipherKey object used in WizCrypt public APIs.

Parameters:
keyStr - The password used for creating the cipher.
Returns:
Returns the initialized CipherKey object for encryption.
Throws:
java.security.NoSuchAlgorithmException - When the Algorithm used by WizCrypt (RC4) is not found in JVM. This is highly unlikely, because SUN JVM has this.
java.io.UnsupportedEncodingException - Password provided is encoded using UTF-8. If UTF-8 encoder is not available in JVM, this exception is thrown. This exception is not likely to happen.
java.security.InvalidKeyException - The key should be of specific size. If this size limits are not met, InvalidKeyException exception is thrown.
javax.crypto.NoSuchPaddingException - This exception is thrown when a particular padding mechanism is requested but is not available in the environment. This also is also highly unlikely to happen.
See Also:
WizCrypt.encrypt(InputStream is, OutputStream os, CipherKey ce), CipherKey

getCipherKeyForDecrypt

public static CipherKey getCipherKeyForDecrypt(java.lang.String keyStr)
                                        throws java.security.NoSuchAlgorithmException,
                                               java.io.UnsupportedEncodingException,
                                               java.security.InvalidKeyException,
                                               javax.crypto.NoSuchPaddingException
This is the public API used for getting the CipherKey object used in WizCrypt public APIs.

Parameters:
keyStr - The password used for creating the cipher.
Returns:
Returns the initialized CipherKey object for decryption.
Throws:
java.security.NoSuchAlgorithmException - When the Algorithm used by WizCrypt (RC4) is not found in JVM. This is highly unlikely, because SUN JVM has this.
java.io.UnsupportedEncodingException - Password provided is encoded using UTF-8. If UTF-8 encoder is not available in JVM, this exception is thrown. This exception is not likely to happen.
java.security.InvalidKeyException - The key should be of specific size. If this size limits are not met, InvalidKeyException exception is thrown.
javax.crypto.NoSuchPaddingException - This exception is thrown when a particular padding mechanism is requested but is not available in the environment. This also is also highly unlikely to happen.
See Also:
WizCrypt.decrypt(InputStream is, OutputStream os, CipherKey ce), CipherKey


Copyright © 2007. All Rights Reserved.