Hello,

In the OpenSSL API there are functions called PEM_write_RSAPrivateKey(), PEM_write_RSAPublicKey() and corresponding read functions: PEM_read_RSAPrivateKey(), PEM_read_RSAPublicKey(). What I need is to read/write RSA keys to/from a file in exactly the same format as these functions do, but I cannot use OpenSSL (due to licensing issues when using OpenSSL in GPL'd code). I've tried to find some GPL'd code that can handle files in such format, but haven't succeeded. What I've managed to find out is that it's a PKCS#1 certificate stored in a PEM file - is that right? Unfortunately, even with such knowledge, I haven't managed to find any specification that would be of any help.

Is there any documentation or a detailed description of the format of the files created by the PEM_write_RSAPrivateKey() and PEM_write_RSAPublicKey()?


As a hint, I can add that the RSA key pair is created this way:

keys = RSA_generate_key(1024, RSA_F4, NULL, NULL);

and the keys are stored to files this way:

PEM_write_RSAPrivateKey(privKeyFile, keys, NULL, NULL, 0, NULL, NULL);
PEM_write_RSAPublicKey(pubKeyFile, keys);


They are read this way:

pubKey = PEM_read_RSAPublicKey(pubKeyFile, NULL, NULL, NULL);
privKey = PEM_read_RSAPrivateKey(privKeyFile, NULL, NULL, NULL);



Tomasz Kaźmierczak
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to