http://www.rsa.com/rsalabs/node.asp?id=2124 has links to the PKCS formats (Public-Key Cryptography Standards).
http://www.rfc-editor.org/rfc/rfc4648.txt has the documentation on the base64 encoding that the PEM_ functions work with. (This is in addition to the links that Dr. Henson has provided.) -Kyle H On Thu, Feb 5, 2009 at 1:04 PM, Tomasz Kaźmierczak <tome...@wp.eu> wrote: > 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 > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org