On Sat, Feb 28, 2004, Guido Noord wrote: > Hi Steve, all, > > If I am not mistaken, the i2d_RSA_PUBKEY method (i2d meaning > internal-to-DER?) does then indeed provide what I need, namely a method to > encode the RSA public key data into a single, portable, platform > independent data representation, DER, which I then can compute the SHA-1 > hash over. >
Yes it does. It does of course assume that the other platforms have a similar encoding function. > But out of curiosity: are the raw datstructures in the EVP_PKEY > datastructure also directly usable (i.e., the raw RSA data)? Rsa_st > contains a few members, such as n, e, d, which seem to match the PKCS1 > notation. However, I do not know if the RSA public key material is stored > machine (byte-order) or OpenSSL independent in rsa_st. If it were, I > suppose I could instead, for example, concatenate rsa_st.n (modulus) and > rsa_st.e (the public exponent) and hash the result directly - or is that > very naive? > They are store in a BIGNUM structure which is what OpenSSL uses for large integers. The format is machine dependent and depends on the endianness of the machine and the compilation options. If you did want to do something like that BN_bn2bin() would convers the BIGNUM to big endian format which is platform independent. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]