Hi Yogesh,
Steps For URL Encryption :
Generate an AES key to perform Encryption
Blob key = Blob.valueOf(‘aAk!h@37WQ9bsAfk’);
2 . Create a Encoded cypher text.
Here we are encoding accountid into cypertext . so consider acc.id as account id .
string encodedCipherText = EncodingUtil.base64Encode(Crypto.encryptWithManagedIV(‘AES128’, key, Blob.valueOf(acc.Id)));
3. Encode cypher text using URLEncode method
string encodedId = encodingUtil.URLEncode(encodedCipherText,’UTF-8′);
4. Now Embed encodeId to your visualforce page url like
https://c.visualforce.com/apex/visualforcePage?id=’+encodedId
Code for Encryption
Blob key = Blob.valueOf(‘aAk!h@37WQ9bsAfk’);
string encodedCipherText = EncodingUtil.base64Encode(Crypto.encryptWithManagedIV(‘AES128′, key, Blob.valueOf(c.Id)));
string encodedId = encodingUtil.URLEncode(encodedCipherText,’UTF-8’);
Encrypted_URL__c = ‘https://c.visualforce.com/apex/visualforcepage?id=’+encodedId));
Thanks.