I've created a public key file using the following commands: openssl genrsa -out mykey.pem 2046 openssl rsa -in mykey.pem -pubout > mykey.pub
I then read it from some C code: public_key = PEM_read_RSA_PUBKEY(fp, NULL, NULL, NULL); and then obtain the DER form of this public key: int len = i2d_RSAPublicKey (public_key, NULL); buf = (unsigned char *) malloc (len); i2d_RSAPublicKey (public_key, &buf); here len == 269 but the command line openssl tells me: openssl rsa -outform der -pubin -inform pem -in mykey.pub | wc writing RSA key 1 10 293 When I print out the DER forms from openssl and my C code they, obviously, don't match and, oddly, the DER encoding that my C code obtains has a lot of zeros. What could I be doing wrong? Regards, Alan ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org