*(gcrypt.info.gz)* Used S-expressions

Info Catalog
*(gcrypt.info.gz)* **Available algorithms**
*(gcrypt.info.gz)* **Public Key cryptography (I)**
*(gcrypt.info.gz)* **Public key modules**
7.2 Used S-expressions
======================
Libgcrypt's API for asymmetric cryptography is based on data structures
called S-expressions (see XXXX) and does not work with contexts as most
of the other building blocks of Libgcrypt do.
The following information are stored in S-expressions:
keys
plain text data
encrypted data
signatures
To describe how Libgcrypt expect keys, we use some examples. Note that
words in uppercase indicate parameters whereas lowercase words are
literals.
(private-key
(dsa
(p P-MPI)
(q Q-MPI)
(g G-MPI)
(y Y-MPI)
(x X-MPI)))
This specifies a DSA private key with the following parameters:
P-MPI
DSA prime p.
Q-MPI
DSA group order q (which is a prime divisor of p-1).
G-MPI
DSA group generator g.
Y-MPI
DSA public key value y = g^x \bmod p.
X-MPI
DSA secret exponent x.
All the MPI values are expected to be in `GCRYMPI_FMT_USG' format.
The public key is similar with "private-key" replaced by "public-key"
and no X-MPI.
An easy way to create such an S-expressions is by using
`gcry_sexp_build' which allows to pass a string with printf-like
escapes to insert MPI values.
Here is an example for an RSA key:
(private-key
(rsa
(n N-MPI)
(e E-MPI)
(d D-MPI)
(p P-MPI)
(q Q-MPI)
(u U-MPI)
with
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 q > p.
U-MPI
multiplicative inverse u = p^-1 \bmod q.

Info Catalog
*(gcrypt.info.gz)* **Available algorithms**
*(gcrypt.info.gz)* **Public Key cryptography (I)**
*(gcrypt.info.gz)* **Public key modules**

*automatically generated by***info2html**