• 孝純 黄
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I am struggling with signing an input with a key generated by using OpenSSL. My code is as follows:

string algorithmName = 'RSA-SHA1' //also tried with 'RSA'

String base64String = 'KBfW9103GQKknExCqOStSmczmNwDNF81yrF04AVvoVI=';
Blob privateKey = EncodingUtil.base64Decode(base64String);
Blob input = Blob.valueOf('12345qwerty');
            
Crypto.sign(algorithmName, input, privateKey);


The base64String is obtained with the command: openssl rand -base64 32

Everytime I run the code I get the following exception in the log:

"common.apex.runtime.impl.ExecutionException: Invalid Crypto Key"|0x4809a271

Does anybody have an idea what am I doing wrong? Thanks