Question

We are trying to read in a public key file into our Delphi application so that we can use it for encrypting some data using OpenSSL. We are stuck at trying to populate the pRSA structure in libeay32.pas.

Basically we have read the modulus and exponent out of the pke file, base 64 decoded them and stored the decoded value in a buffer of type Byte.

From what we can tell these now need to be converted into a BIGNUM structure. Libeay32 provides a function BN_bin2bn function which accepts a pointer an output a pBIGNUM.

The question is, can we pass the modulus and exponent buffers directly to BN_bin2bn or do they first need to be converted to a format compatible with the BN_bin2bn function?

We are using Delphi 2007.

Was it helpful?

Solution

I've solved this. There is no conversion required. The Modulus and Exponent can be base 64 decoded into a buffer and then passed straight into the BN_bin2bn function as is

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top