4

The Salesforce crypto class documentation specifies that a private key should be stored as a protected custom setting.

"A PKCS8 formatted private key in base64 decoded form is required. This private key should not be hardcoded in the Apex script but should be stored in a protected custom setting or a encrypted fields in a custom table"

https://developer.salesforce.com/page/Apex_Crypto_Class

How do I do this because it seems that custom setting field values are limited to 255 characters?

Thanks

3

The only decent option is to split the private key into separate parts (probably around 10) and save those into the fields. Then in your code, concatenate the parts into the complete key.

I personally prefer a custom object field because it can be encrypted. Custom settings are accessible by all users with view setup/config rights.

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.