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
Etienne Gaudry 5Etienne Gaudry 5 

RSA encryption(OAEP Padding) with public key

Hey :)

I need to set up an api connection. I get a public key which should allow me to encrypt (RSA encryption(OAEP Padding)) my login and my password to obtain a tokken. An idea to succeed in this?

My public key is like :
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVM2aEf0F6jm34nQ5ovx8Om0UvDkSWSSXgwWwSE4+0y4+8X715konvQjb0XkB3PIV/DA6JAqjXqyxd6yGGXXMpLYuZnRYBuaeeDlDjJggq+CQnPcNpAiYTsXKAT/YG5rG1WT5x6vBUG6lTyZDwZce7rlk+caCY8R6Wl3hu7HWODwIDAQAB

I tried this method :
https://gist.github.com/karmats/4270441be5a34fff7062
but I don't understand the value I should give to modulus and exponent.

Ty for your help !

AnudeepAnudeep (Salesforce Developers) 
Hi Etienne, 

The values below are extracted based on your public key

Exponent: 65537

Modulus: 00 D5 33 66 84 7F 41 7A 8E 6D F8 9D 0E 68 BF 1F 0E 9B 45 2F 0E 44 96 49 25 E0 C1 6C 12 13 8F B4 CB 8F BC 5F BD 79 92 89 EF 42 36 F4 5E 40 77 3C 85 7F 0C 0E 89 02 A8 D7 AB 2C 5D EB 21 86 5D 73 29 2D 8B 99 9D 16 01 B9 A7 9E 0E 50 E3 26 08 2A F8 24 27 3D C3 69 02 26 13 B1 72 80 4F F6 06 E6 B1 B5 59 3E 71 EA F0 54 1B A9 53 C9 90 F0 65 C7 BB AE 59 3E 71 A0 98 F1 1E 96 97 78 6E EC 75 8E 0F

I used this decoder

To learn more about to read these values see this post

If you find this information helpful, please mark this answer as Best. It may help others in the community. Thank You!

Anudeep