|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.handlers.cryptography.Cryptography
public class Cryptography
This class provides a wrapping for the Encryption and Decryption functionalities.
Field Summary | |
---|---|
private javax.crypto.Cipher |
c
The Cipher ing instance used in encryption and decryption |
private static char[] |
hexChar
The hexadecimal characters in an array to be used in converions from string to hexadecimals, and in validations. |
private javax.crypto.SecretKey |
key
The SecretKey instance used in encryption and decryption (generated) from the password and the SALT |
private javax.crypto.spec.PBEParameterSpec |
paramSpec
|
Constructor Summary | |
---|---|
Cryptography(java.lang.String strPassword,
java.lang.String strSalt)
Constructor. |
Method Summary | |
---|---|
java.lang.String |
Decrypt(java.lang.String strValue)
Decrypts the given strValue using the instantiated object of Password and Salt |
java.lang.String |
Encrypt(java.lang.String strValue)
Encrypts the given strValue using the instantiated object of Password and Salt |
protected static byte[] |
toBinArray(java.lang.String hexStr)
Converts a Hexadecimal String into a binary array. |
static java.lang.String |
toHexString(byte[] b)
Converts a String to its equivalent Hexadecimal representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final char[] hexChar
private javax.crypto.Cipher c
Cipher
ing instance used in encryption and decryption
private javax.crypto.SecretKey key
SecretKey
instance used in encryption and decryption (generated) from the password and the SALT
private javax.crypto.spec.PBEParameterSpec paramSpec
Constructor Detail |
---|
public Cryptography(java.lang.String strPassword, java.lang.String strSalt) throws java.lang.Exception
Encrypt
or Decrypt
.
strPassword
- Password used in creating the SecretKey
.strSalt
- the Salt used in in creating the SecretKey
.
java.lang.Exception
Method Detail |
---|
public java.lang.String Encrypt(java.lang.String strValue) throws java.lang.Exception
strValue
using the instantiated object of Password and Salt
strValue
- the value to Encrypt
String
java.lang.Exception
public java.lang.String Decrypt(java.lang.String strValue) throws java.lang.Exception
strValue
using the instantiated object of Password and Salt
strValue
- the value to Decrypt
String
java.lang.Exception
public static java.lang.String toHexString(byte[] b)
String
to its equivalent Hexadecimal representation.
b
- the byte[]
to be converted into Hexadecimal String
protected static byte[] toBinArray(java.lang.String hexStr)
String
into a binary array.
hexStr
- The Hexadecimal String
to be converted.
byte[]
representing the binary array.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |