Archived Forum Post

Index of archived forum posts

Question:

Using byte arrays as keys (RSA)

Jun 20 '16 at 11:51

I am trying to use the RSA-512 functions from Delphi (Non ActiveX DLL).

I receive the N key (64 bytes) and the E key (4 bytes) in binary form from a connected device.

I want to import these keys into the rsa object, but don't quite know how to do it.

Id be grateful if someone could point me in the right direction !


Answer

See this example: https://www.example-code.com/delphiDll/rsa_encryptModExp.asp

For you, it's just a matter of creating a base64 string representation of the N (modulus) and E (exponent). The exponent will very likely always be decimal 65001, which is "AQAB" in base64.