help-gnutls
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing a PKCS#1 RSAPublicKey structure into a gnutls_pubkey_t


From: Nikos Mavrogiannopoulos
Subject: Re: Importing a PKCS#1 RSAPublicKey structure into a gnutls_pubkey_t
Date: Sat, 04 Aug 2012 22:31:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120624 Icedove/10.0.5

On 08/03/2012 02:39 PM, René Korthaus wrote:

> Hello list,
> 
> I have a smartcard that gives me a PKCS#1 RSAPublicKey structure of the
> public key on the card and I need to generate a X.509
> SubjectPublicKeyInfo structure from it. I already have a C++ wrapper
> class that uses gnutls_pubkey_export to generate the
> SubjectPublicKeyInfo structure. The question is how to import the
> RSAPublicKey structure right.


There is no exported function in gnutls that can read the RSAPublicKey
structure. gnutls_rsa_params_t reads the private key not the public (the
documentation has a typo which I just fixed).

You can read this DER structure by using libtasn1. Check
lib/x509/key_decode.c, and the function _gnutls_x509_read_rsa_pubkey().
After extracting the values you can import them using
gnutls_pubkey_import_rsa_raw().

regards,
Nikos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]