|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.util.Encrypt
com.sptci.util.TripleDESEncrypt
public class TripleDESEncrypt
A utility class used to implement Triple DES (3DES) encryption and decryption of strings.
The following shows sample use of this class:
import com.sptci.util.TripleDESEncrypt;
...
TripleDESEncrypt des = new TripleDESEncrypt();
String secret = "my secret value";
String key = "my secret key";
byte[] encrypted = des.encrypt( key, secret );
...
String mysecret = des.decrypt( key, encrypted );
© Copyright 2007 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
protected static String |
ALGORITHM
The encryption algorithm to use to encrypt strings. |
protected static String |
SCHEME
The encryption scheme to use to encrypt strings}. |
| Fields inherited from class com.sptci.util.Encrypt |
|---|
ENCODING, KEY_LENGTH, keyLength |
| Constructor Summary | |
|---|---|
TripleDESEncrypt()
Default constructor. |
|
| Method Summary | |
|---|---|
protected byte[] |
crypt(String key,
byte[] value,
int mode)
Encrypt/decrypt the specified value using the specified
key. |
| Methods inherited from class com.sptci.util.Encrypt |
|---|
decrypt, encrypt, getKey, handleException |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String ALGORITHM
protected static final String SCHEME
| Constructor Detail |
|---|
public TripleDESEncrypt()
DESedeKeySpec.
| Method Detail |
|---|
protected byte[] crypt(String key,
byte[] value,
int mode)
throws InvalidKeyException,
BadPaddingException,
RuntimeException
value using the specified
key.
crypt in class Encryptkey - The key to use to encrypt the value.value - The value that is to be encrypted or decrypted.mode - The operation mode of this cipher (this is one of the
following: Cipher.ENCRYPT_MODE, Cipher.DECRYPT_MODE, Cipher.WRAP_MODE or Cipher.UNWRAP_MODE).
InvalidKeyException - If the given key is inappropriate for
initializing the Cipher, or its keysize exceeds the
maximum allowable keysize (as determined from the configured jurisdiction
policy files).
BadPaddingException - Thrown if the key cannot be used
to decrypt the value. Should be thrown only during decrypt
operations.
RuntimeException - If IllegalBlockSizeException,
NoSuchPaddingException, NoSuchAlgorithmException are raised while encrypting or
decrypting.Encrypt.getKey(java.lang.String)
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||