Reading .pem files for secured

Sebastiaan Koppe mail at skoppe.eu
Fri May 31 12:17:14 UTC 2019


On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote:
> The key pair needs to be persistant between, so I made a 
> 4096-bit private key with OpenSSL, stored in .pem file. Then I 
> constructed a public key from the private one, again with 
> OpenSSL. It seemed strange to me that I could generate a public 
> key afterwards with the private key, instead of having to do 
> both at the same time. I just thought that perhaps crypto is 
> somehow cryptic enough to do that.

The public key can always be constructed from the private key.

> But then came a problem that I need to feed the key from .pem 
> to initialize RSA class.

Just base64 decode the PEM data (without the ====) and feed it to 
RSA.this(ubyte[] publicKey). Ought to be that simple.

Disclaimer: I have only used openssl directly. No experience with 
SecureD.


More information about the Digitalmars-d-learn mailing list