Encrypting numeric value as encrypted numeric value
Hi,
I am Using Sun JCE (DES algorithm) for encryption. My requirement is to read data from DB2 and encrypt and insert it to an Microsoft Access database.
I am sucessfully able to encrypt character data types and able to store it in the MS Access.
But for numeric data i am able to encrypt but not able to store in access since it contain non numeric character.
I can not modify the data type in MS Access also, since the application using this database will lose its functionality. I am attaching few line of code which i am using for encryption.
Is there any solution to achive my requirement? Please let me know.
Thanks
GS
public String encrypt(String data) throws Exception {
try {
// Our cleartext as bytes. Use UTF8 as the standard
byte[] cleartext = data.getBytes("UTF8");
// Encrypt the cleartext
byte[] ciphertext = _encryptionCipher.doFinal(cleartext);
String str = null;
BASE64Encoder b64nCoder = new BASE64Encoder();
str = b64nCoder.encode(ciphertext);
// Return a String representation of the cipher text
String eStr = new String(ciphertext);
return str;
} catch (IllegalBlockSizeException e) {
throw (e);
} catch (BadPaddingException e) {
throw (e);
}
}

