An ECC private key is described by this S-expression:
(private-key (ecc (p p-mpi) (a a-mpi) (b b-mpi) (g g-point) (n n-mpi) (q q-point) (d d-mpi)))
All point values are encoded in standard format; Libgcrypt does in
general only support uncompressed points, thus the first byte needs to
be 0x04
. However “EdDSA” describes its own compression
scheme which is used by default; the non-standard first byte
0x40
may optionally be used to explicit flag the use of the
algorithm’s native compression method.
The public key is similar with "private-key" replaced by "public-key" and no d-mpi.
If the domain parameters are well-known, the name of this curve may be used. For example
(private-key (ecc (curve "NIST P-192") (q q-point) (d d-mpi)))
Note that q-point is optional for a private key. The
curve
parameter may be given in any case and is used to replace
missing parameters.
Currently implemented curves are:
NIST P-192
1.2.840.10045.3.1.1
prime192v1
secp192r1
NIST P-224
secp224r1
NIST P-256
1.2.840.10045.3.1.7
prime256v1
secp256r1
NIST P-384
secp384r1
NIST P-521
secp521r1
OID.
or oid.
.