I have found the problem and fixed it in my code, so please ignore.
However, for general info, it seems that the i2d_ low-level functions modify
the data pointer passed in (it is an unsigned char **), so I could not see
the result.  Copying the pointer to another and passing the address of that
in solves the problem.  I had come across this with decoding so I guess it's
a global quirk in the code!
Chris Brook

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Chris Brook
Sent: Friday, September 20, 2002 10:08 AM
To: Openssl-Dev (E-mail)
Subject: SSL-0.9.7 RSA keys


Using 0.9.7 beta 3, I am attempting to output an RSA public/private key pair
created by RSA_generate_key() as ASN.1 encoded strings.
For the public key, I am using i2d_RSA_PUBKEY which calls i2d_PUBKEY ->
i2d_X509_PUBKEY.  i2d_X509_PUBKEY seems to execute though I can't find the
code anywhere in the source.  It returns a correct length but the result
string is empty - all zero's.
I am using i2d_PKCS8_PRIV_KEY_INFO() to get the ASN.1 encoded private key as
a PKCS8 PrivateKeyInfo.  This behaves the same way: returns length but empty
value.  In both cases the data structures were correctly set up with good
values.  Is the problem that these are phantom functions?  I get no error
during compiling or linking, so where are they????
Is there a better way to do this?  The opposite functionality using d2i_xxxx
works just fine.
Chris Brook
V-ONE

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to