You need to sign in to do that
Don't have an account?
t.deepthi05
I am showing up the error for some records
Encryption
string lid=l[0].id+'';
String key1 = Label.PWV_CryptoKey;
Blob Key = Blob.valueOf(key1);
Blob data = Blob.valueOf(lid);
Blob encryptedData = Crypto.encryptWithManagedIV('AES128', key, data);
String b64Data = EncodingUtil.base64Encode(encryptedData);
string leaURL =Label.PWV_FavoriteURL+'lid='+b64Data;
l[0].Encrypted_URL__c =leaURL;
Decryption:
String key1 = Label.PWV_CryptoKey;
Blob Key = Blob.valueOf(key1);
oid=ApexPages.currentPage().getParameters().get('oId');
Blob data = EncodingUtil.base64Decode(oid);
Blob decryptedData = Crypto.decryptWithManagedIV('AES128', key, data);
String decryptedDataString = decryptedData.toString();
Input length must be multiple of 16 when decrypting with padded cipher
I am showing up the error for some records
Encryption
string lid=l[0].id+'';
String key1 = Label.PWV_CryptoKey;
Blob Key = Blob.valueOf(key1);
Blob data = Blob.valueOf(lid);
Blob encryptedData = Crypto.encryptWithManagedIV('AES128', key, data);
String b64Data = EncodingUtil.base64Encode(encryptedData);
string leaURL =Label.PWV_FavoriteURL+'lid='+b64Data;
l[0].Encrypted_URL__c =leaURL;
Decryption:
String key1 = Label.PWV_CryptoKey;
Blob Key = Blob.valueOf(key1);
oid=ApexPages.currentPage().getParameters().get('oId');
Blob data = EncodingUtil.base64Decode(oid);
Blob decryptedData = Crypto.decryptWithManagedIV('AES128', key, data);
String decryptedDataString = decryptedData.toString();
This may help : http://salesforce.stackexchange.com/questions/40340/encryption-and-decryption-in-salesforce