ing. Jiri Holinek wrote:
>
> Sorry for my English.
> I have a simple program for generating RSA key with writting it in
> DER format. But key converted with i2d_RSAPrivateKey function to
> DER format is invalid.
> openssl rsa -infrom der -in privkey.der reports:
>
> read RSA key
> unable to load key
> 8317:error:0D09D082:asn1 encoding
> routines:d2i_RSAPrivateKey:parsing:d2i_r_pr.c:116:
>
> The code and generated key is in attachment.
> Compiled on RedHat 6.1 Linux with OpenSSL 0.9.5a
>
> Where did I a mistake please?
Without seeing your program it is difficult to see what is wrong.
That file looks like garbage which is probably caused by misuse of the
ASN1 functions.
For example the "buffer" argument gets modified after the call so you
should pass a temporary variable pointing to the buffer to the ASN1
function.
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]