• irving wang
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
    I encountered a problem. Now there is a development requirement that I need to call other system interfaces in the opportunity trigger to transfer records to other systems.
    However, some parameters encrypted with the RSA public key need to be placed in the request header of the interface. I found out after looking at the documentation that apex doesn't provide a way to do RSA public key encryption directly.
    It seems that it can only be realized by using a java program to encrypt it?
    I encountered a problem. Now there is a development requirement that I need to call other system interfaces in the opportunity trigger to transfer records to other systems.
    However, some parameters encrypted with the RSA public key need to be placed in the request header of the interface. I found out after looking at the documentation that apex doesn't provide a way to do RSA public key encryption directly.
    It seems that it can only be realized by using a java program to encrypt it?
Crypto (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_crypto.htm) class supports only AES algorithm for Encryption and Decrypion. I have a usecase where I need to encrypt my HTTP request payload using a certificate which supports RSA Encryption algorithm. 
So, should I write custom code to implement RSA encruption/Decryption algorithm? Is this the recommended approach/Best Practice? 
Hi developers,

I have a problem encrypting a string using RSA with a public key. Since the Crypto class only supports encrypting/decrypting using private keys, I will have to do this "manually". The problem with this approach is that I have to deal with really large numbers, which makes the operation to take a significant amount of time (System.LimitException: Apex CPU time limit exceeded).

Has anyone had similar problem and maybe point me to a solution for this? Right now I'm looking into making this into a Batch job, but that doesn't really feels like the best approach.

Thanks