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
karimulla testingkarimulla testing 

ENCRYPTION IN SALESFORCE

(Encrpting with key "1234567890123456" it is getting encrpted):
Blob key = Blob.valueOf('1234567890123456');  //WITH 16BYTES
String myStringToEncrypt = 'This is my String....'
Blob myBlobData = Blob.valueOf(myStringToEncrypt)
Blob myEncryptedString = Crypto.encryptWithManagedIV('AES256', key, myBlobData)

(Encrpting with key "INDIA" it is  not getting encrpted)  :
SHOWING ERROR:  Invalid private key. Must be 16 bytes.

Blob key = Blob.valueOf('INDIA'); //
String myStringToEncrypt = 'This is my String....'
Blob myBlobData = Blob.valueOf(myStringToEncrypt)
Blob myEncryptedString = Crypto.encryptWithManagedIV('AES256', key, myBlobData)

/// I KNOW THAT IT SHOULD BE 16 BYTES REQUIRED
//////bt in .net application they used the key "INDIA" and encrpted with 'AES256'.. need samekey "INDIA"   in salesforce ...MAY I GET THE SOLUTION
SandhyaSandhya (Salesforce Developers) 
Hi,

You can refer below link for similar discussion.

https://developer.salesforce.com/forums/?id=906F00000008yfxIAA
 
Please mark it as Solved if my reply was helpful. It will make it available for other as the proper solution.
 
Thanks and Regards
Sandhya