Importing a PKCS#1 RSAPublicKey structure into a gnutls_pubkey_t

René Korthaus r.korthaus at sirrix.com
Tue Aug 7 09:11:23 CEST 2012


Thanks for the clarification. Then is there a reason that gnutls offers 
no method to import a PKCS#1 RSAPublicKey structure - given that it is a 
standard format and almost all smartcards speak it plus RSAPublicKey is 
very similar to RSAPrivateKey and gnutls can already decode 
RSAPrivateKey structures with _gnutls_privkey_decode_pkcs1_rsa_key. From 
the code I've seen it should be fairly easy to implement and would make 
us very happy. :)

Regards, René

Am 04.08.2012 22:31, schrieb Nikos Mavrogiannopoulos:
> 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


-- 
Sirrix AG security technologies - http://www.sirrix.com
René Korthaus      eMail: r.korthaus at sirrix.com
Tel +49(681) 959 86-163    Fax +49(681) 959 86-5163
PGP Key ID 0x688EF9C8    Fingerprint 1FB6 2405 51C4 79DB C008 D1D2 C2E0 1A14 688E F9C8
Vorstand: Ammar Alkassar (Vors.), Christian Stüble, Markus Bernhammer
Vorsitzender des Aufsichtsrates: Harald Stöber
Sitz der Gesellschaft: Homburg/Saar, HRB 3857 Amtsgericht Saarbrücken

This message may contain confidential and/or privileged information. If you are not the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and
delete this message.





More information about the Gnutls-help mailing list