manpagez: man pages & more
info gcrypt
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.1 RSA key parameters

An RSA private key is described by this S-expression:

(private-key
  (rsa
    (n n-mpi)
    (e e-mpi)
    (d d-mpi)
    (p p-mpi)
    (q q-mpi)
    (u u-mpi)))

An RSA public key is described by this S-expression:

(public-key
  (rsa
    (n n-mpi)
    (e e-mpi)))
n-mpi

RSA public modulus n.

e-mpi

RSA public exponent e.

d-mpi

RSA secret exponent d = e^{-1} \bmod (p-1)(q-1).

p-mpi

RSA secret prime p.

q-mpi

RSA secret prime q with p < q.

u-mpi

Multiplicative inverse u = p^{-1} \bmod q.

For signing and decryption the parameters (p, q, u) are optional but greatly improve the performance. Either all of these optional parameters must be given or none of them. They are mandatory for gcry_pk_testkey.

Note that OpenSSL uses slighly different parameters: q < p and u = q^{-1} \bmod p. To use these parameters you will need to swap the values and recompute u. Here is example code to do this:

  if (gcry_mpi_cmp (p, q) > 0)
    {
      gcry_mpi_swap (p, q);
      gcry_mpi_invm (u, p, q);
    }

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on February 9, 2014 using texi2html 5.0.

© manpagez.com 2000-2018
Individual documents may contain additional copyright information.