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
Lynn ShawLynn Shaw 

Does Crypto.signWithCertificate() method support SHA-512?

Is there a way to use the Crypto.signWithCertificate() method using SHA-512?  We need to be able to sign a string using SHA-512, not any of the lower algorithms.

Several of the other Crypto methods support SHA-512, but the documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_crypto.htm) does not list 512, nor will it work when we tried it in our code:

Blob signedSecret = Crypto.signWithCertificate('SHA-512', blobSecret, certificateName);

Suggestions?
 
Marcelo CostaMarcelo Costa

I guess not by default...

According to documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_crypto.htm) The Crypto class ony supports SHA1, SHA256 or RSA...

In this case, your choices are check if there is an Idea on that, and, if not create it... or implement the Crypto by yourself.

Looks like someone did something like that in this post:
https://developer.salesforce.com/forums/?id=906F0000000928TIAQ

Good Luck :)