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.

1 Answer 1

3

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .