How to save a certificate in file using libp11

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to save a certificate in file using libp11

xabi esteban
Hello:
I'm trying to get the certificate from my card and save it in a file as cert.pem for example
I did it using command line but i have not idea how to do it with libp11 in my C program.

In auth.c you get the certificate in a structure but i don't know how to use it to make the file with the certificate

Thanks.


¿Sabes que la Videollamada de Messenger es GRATIS ¡Descúbrela!
_______________________________________________
opensc-user mailing list
[hidden email]
http://www.opensc-project.org/mailman/listinfo/opensc-user
Reply | Threaded
Open this post in threaded view
|

Re: How to save a certificate in file using libp11

Andreas Jellinghaus-2
Am Mittwoch 31 März 2010 19:35:59 schrieb xabi esteban:
> Hello:
> I'm trying to get the certificate from my card and save it in a file as
>  cert.pem for example I did it using command line but i have not idea how
>  to do it with libp11 in my C program.
>
> In auth.c you get the certificate in a structure but i don't know how to
>  use it to make the file with the certificate

the auth.c has this definition:
        PKCS11_CERT *certs;

and in libp11.h you can see this:
typedef struct PKCS11_cert_st {
        char *label;
        unsigned char *id;
        size_t id_len;
        X509 *x509;
        void *_private;
} PKCS11_CERT;

and X509 is the standard structure for certificates from openssl,
so have a look at openssl api how to save such an object to a file.

Regards, Andreas
_______________________________________________
opensc-user mailing list
[hidden email]
http://www.opensc-project.org/mailman/listinfo/opensc-user