> Thank's for the answer, but i still got a little problem,
> when i run this code :

> EVP_PKEY *key2 = X509_get_pubkey(certif.getX509Certificate());
> cout << BN_bn2hex(key2->pkey.rsa->n);

> I miss the first 00 of the public key...
> How can i get them ?

The leading '00' is part of the DER encoding of the data portion, it is not
part of the number. It is required when the number would otherwise be
considered negative (because its high bit would be set) and prohibited
elsewhere. The command you issued outputs the numerical value.

I think you are asking for something that is not sensible. If you're going
to compare it to something else, you should be comparing the full DER
encoding. If you want it for any other purpose, you shouldn't want the
leading 0, since it's an artifact of DER encoding.

If you want to compare the DER encodings, you need to get the DER encoding,
not the number. If you want to compare the numbers, '03' should compare
equal to '3' anyway. What are you trying to do?

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to