function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
itsaws11itsaws11 

Unable to decrypt the userName and Password pass from URL .

Hi folks,

 

I am passing my username thrugh url using encrption.But during fetching of url(from second page) it is unable to decrpt username.Please help me on this.Follow the below code which aceess the "https://c.ap1.visual.force.com/apex/MySecondPage?username=r+6QYqHGBsbrkKDopBSy6i3v2JykazW2+C4YBSoK5Z4%3D" url from second page.

                               public String Valueone{get;set;}

                               Valueone = ApexPages.currentPage().getParameters().get('username');
                               Blob b64dcrypted = EncodingUtil.base64Decode(Valueone);
                               Blob cryptoKey = Crypto.generateAesKey(128);
                               Blob decryptedData = Crypto.decryptWithManagedIV('AES128', cryptoKey, b64dcrypted);
                               System.debug('>>>>>>>>>>>>>>>>>>>>>>>>>>>>' + decryptedData.toString() );

this codd shows me the following message.(Even I have pass algorithmName as AES128,AES192,AES256 but facing same problem)

System.SecurityException: Input length must be multiple of 16 when decrypting with padded cipher .

 

Regards,

Itsaws11

Bhawani SharmaBhawani Sharma
Why do you want to pass the username in URL? Can't you get it through UserInfo.getUserName();?
itsawsitsaws
Hi Bhawani,

Thanks for your quick reply.I have to pass username(encrypt) and password(Encrypt) thrugh url.which should be decrpyt in constructor of my second page.


Regards
Itsaws11