Hi,
>   
>> I have to check that a certificate is encrypted with RSA and not DSA. I
>> can't find any API function for that.
>> Please help me.
>>     
>
> EVP_PKEY *pkey;
>
> if ( (pkey = X509_get_pubkey(cert)) == NULL ){
>       goto err;
> }
> if (pkey->type == EVP_PKEY_RSA ){
>       // RSA
> else if (pkey->type == EVP_PKEY_DSA) {
>       // DSA
> else {
>       // NOT RSA AND NOT DSA :-)
> }
> EVP_PKEY_free(pkey);
>
> Best regards,
>   
Thank you so far.
I don't know how to load a certificate which is my problem in the first
place. I looked in apps/x509.c which uses load_cert() from apps/apps.c,
but alas this can't be used as an API function. Am I missing something?

I could'nt find any other function that loads a certificate from a file
and provides a X509*. I've seen that some algorithms use cert from
SSL_CTX  which is a cert_st struct. Unfortunalety this struct isn't
defined anywhere in the public header files (just in the private
ssl/ssl_autl.h), so I can't use it without getting in danger of making
my program incompatible to other openssl versions.

If anyone knows a way how to load a certificate from a file and obtain
it's X509* I would be glad.
Cheers,

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

Reply via email to