ietf-openpgp
[Top] [All Lists]

Re: [openpgp] patch for EdDSA key packet formats

2017-02-14 21:20:45
Taylor R Campbell <campbell+ietf-openpgp(_at_)mumble(_dot_)net> wrote:
Right, but in RFC 8032, the letter `A' does mean a point on the curve.

Yes.

What my text says is that we encode the point A using the encoding
described below in the Section 13.3 `EdDSA Point Format'.  This is not
the same as storing the RFC 8032 public key, which is the point A
encoded as ENC(A).

It may be that the Section 13.3 `EdDSA Point Format' encoding is
actually 0x40 || ENC(A), but I'm not sure offhand.

I believe this (0x40 || ENC(A)) is the `EdDSA Point Format' encoding.

You are probably right!  I'm afraid I neglected to write notes when I
prepared the patch, so I forgot where in the code I should have cited
for that.  Do you have a quick reference to the source code in
libgcrypt or gnupg that handles encoding this?

In GnuPG, secret keys are primarily handled by gpg-agent with libgcrypt.
And libgcrypt stores them in the format of SEXP [0].  So, GnuPG only
handles OpenPGP secret keys when importing/exporting in OpenPGP format.

For importing, we have the function parse_key in
gnupg/g10/parse-packet.c:2112 (in the release 2.1.18).  When secret key
is not protected, it is handled by the mpi_read function (at line 2526).
Here, in the code, the expression is "pk->pkey[i]", where pk and pkey
stand for "public key", but this is because of historical reason, it
means secret key materials.

And then, it is handled by the function transfer_secret_keys in
gnupg/g10/import.c:1788.  It composes SEXP around line 1917, by "%m"
format, which means MPI, to send gpg-agent.

Exporting is similar.  In the function do_key in
gnupg/g10/build-packet.c:354, non-protected secret key is
written by gpg_mpi_write at line 478.

So, for the GnuPG implementation, secret key is handled as MPI.  But I
think that this is basically due to its historical reason, when keys in
OpenPGP format were specified as MPI.


For specification, "an opaque octet string k" may be better.  I support
this, personally.

On the other hand, I don't know why the ECC format of

        04 || x || y

was described as MPI in RFC6637.  For me, it is an octet string composed
by two MPIs and the prefix.


[0] SEXP --- (S-expressions)
http://people.csail.mit.edu/rivest/sexp.html
-- 

_______________________________________________
openpgp mailing list
openpgp(_at_)ietf(_dot_)org
https://www.ietf.org/mailman/listinfo/openpgp

<Prev in Thread] Current Thread [Next in Thread>