2

There's a Blob I generated by encrypting a certain string:

Blob data = Blob.valueOf('my string');
Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);

Is there a way to convert the encryptedData Blob into an alphanumeric string? (something like "vl45v54vnk")
And then back to that same Blob?

I tried encryptedData.toString() and String.valueOf(encryptedData) - didn't work.

3

Use EncodingUtil.base64encode to convert to a String, and base64decode to get back to a Blob.

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.