on 01-29-2010 4:52 AM
Hi All ,
M worknig with NWCE 7.1.1. I have written code for decryption for decryption. Earlier my web dynpro application was on CE7.1. We migrated it to CE 7.1.1 just week ago after migrating to CE 7.1.1 , on execution of decryption code m gtting as
javax.crypto.IllegalBlockSizeException: Input data length not a multiple of blocksize
i have written following code for decryption.
public String decrypt( String encryptedString, String encryptionKey )
{
String UNICODE_FORMAT = "UTF8";
try
{
if ( encryptedString == null || encryptedString.trim().length() <= 0 )
throw new IllegalArgumentException( "encrypted string was null or empty" );
byte[] keyAsBytes = encryptionKey.getBytes(UNICODE_FORMAT);
keySpec = new DESKeySpec(keyAsBytes);
keyFactory = SecretKeyFactory.getInstance( "DES" );
cipher = Cipher.getInstance( "DES" );
SecretKey key = keyFactory.generateSecret( keySpec );
cipher.init( Cipher.DECRYPT_MODE, key );
BASE64Decoder base64decoder = new BASE64Decoder();
byte[] cleartext = base64decoder.decodeBuffer( encryptedString );
byte[] ciphertext = cipher.doFinal( cleartext );
return new String( ciphertext );
}catch (Exception e){
IWDMessageManager messageManager = wdComponentAPI.getMessageManager();
messageManager.reportException("Error while Decryption");
e.printStackTrace();
return "";
}
}
This code was working fine in CE 7.1 . After migrating to CE 7.1.1 it started giving this error.
Hi Kavita
I see that the thread is marked as answered?
Were you able to solve the problem?
Thanks
Kenny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.