0

Encription Decription Throws Error Some time. Comman pattern that fails is Encripted Text text to decript is when i am passing in encripted text into URL and if URL contains % or + it throws Error.

Encripted text - throws Error while decription. Using Encription with Crypto.encryptWithManagedIV('AES128', cryptoKey , data );

k2vAafArfVvfbITPdKLvtCVHsa/M+84/R/rcXjEBlVQA14sqspntuQn0mKDiaPdL 

Input length must be multiple of 16 when decrypting with padded cipher 
  • I am Passing the Encoded string in URL. So please share That works with URL Encoding and Decoding. – Innodel Salesforce Feb 3 '17 at 12:49
1

Try EncodingUtil Class to encode the encrypted string before passing in URL. Also there is a decode method is available to decode the encoded string.

String encodedString = EncodingUtil.urlEncode(encryptedString,'UTF-8');
String decodedString = EncodingUtil.urlDecode(encodedString ,'UTF-8');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.