help-gnutls
[Top][All Lists]
Advanced

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

[Help-gnutls] Re: Generating an RSA key


From: Simon Josefsson
Subject: [Help-gnutls] Re: Generating an RSA key
Date: Mon, 30 Oct 2006 10:17:36 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux)

Brad Hards <address@hidden> writes:

> I'm trying to write some code that generates RSA keys (given either the raw 
> parameters, and also given the exponent and bit size), and then extract 
> various things (bit size, public key), and some I/O in DER and PEM formats.
>
> I'd prefer it if I could avoid learning the sexp stuff used in libgcrypt. 
> However I can't find the right part of the API.
>
> Does anyone have a suggestion or example code that they would be willing to 
> share?

Hi!  I'm not aware of any code that does exactly what you want,
although look in lib/x509/privkey.c for some functions that converts
to and from raw RSA keys to PKCS#1 format.

In particular, perhaps gnutls_x509_privkey_export_rsa_raw() and
gnutls_x509_privkey_import_rsa_raw() does something similar to what
you want?

To generate the key, you can use gnutls_x509_privkey_generate() as a
basis for your code, and replace the call to
_gnutls_rsa_generate_params() with a call to your own function that
generates the same values.  They use the libgcrypt mpi_t type, but you
wouldn't have to use the sexp stuff.

Just some ideas..

/Simon




reply via email to

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