Reading .pem files for secured

Dukc ajieskola at gmail.com
Mon Jun 3 07:55:37 UTC 2019


On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote:
> if I understand the logic of Base64, it's that each character 
> stores 6 bits. My private key .pem has 49 lines of 64 
> characters worth of Base64, though the sat line isn't full. 
> Anyway, this is data worth of over 18000 bits. The RSA key is 
> supposed to be 4096 bits, so this can't be correct.
>
> What am I missing?

I think that what I missed was that .pem key files do not only 
contain the key, they also contain the public exponent (even 
though it's always the same 0x10001), and in case of private key, 
the root parameters used to generate the key pair (not sure if it 
contains the public key also). That explains why the private key 
file is so much larger than the key bit count would dictate.

And by looking at members of RSA class at SecureD, I think it 
also keeps those extra components, implying that everything in 
.pem should go in (after decoding), not just the public or 
private key. Like Koppe said.



More information about the Digitalmars-d-learn mailing list