On Fri, Sep 11, 2009, Michael Prinzinger wrote:

> Dear Group,
> 
> I want to use the openssl crypt library to sign and verify messages.
> Apparently I can use a RSA struct and RSA_sign and RSA_verify for that.
> 
> however my certificates are of the form
> -----BEGIN CERTIFICATE-----
> MIIDDTCCAnagAwIBAgIJAMWKwoNrQvTvMA0GCSqGSIb3DQEBBQUAMGMxCzAJBgNV
> ...
> -----END CERTIFICATE-----
> 
> how ever can I load such a certificate into my RSA struct?
> concerning encryption, for public and private keys I could use
> PEM_read_RSAPublicKey and PEM_read_bio_RSAPublicKey
> to load my keys.
> 
> Are there methods like this for certificates and certificate private keys?
> 

The low level RSA_sign() and RSA_verify() functions shouldn't be used to sign
bulk data. Instead you should use the EVP_Sign*() and EVP_Verify*() interface.
There you use a generalised key structure EVP_PKEY. You can get a public key
from a certificate using X509_get_pubkey(). 

You can get a private key into an EVP_PKEY structure using
PEM_read_PrivateKey() and a certificate into an X509 structure using
PEM_read_X509(). See the manual pages for more information and actual
examples.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to