Brad Hards <[EMAIL PROTECTED]> 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 _______________________________________________ Help-gnutls mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gnutls
