Howto read a mpi point from buffer?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Howto read a mpi point from buffer?

Stef Bon
Hi,

I'm implementing the ed25519 pubkey method in my application using libgcrypt.
Earlier I'v added rsa and dss.

I cannot find a function to read a mpi point. Is there one?

Stef

_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Howto read a mpi point from buffer?

Stef Bon
2017-06-10 7:32 GMT+02:00 Stef Bon <[hidden email]>:
> Hi,
>
> I'm implementing the ed25519 pubkey method in my application using libgcrypt.
> Earlier I'v added rsa and dss.
>
> I cannot find a function to read a mpi point. Is there one?
>

The file I want to read is the public key stored by openssh, where the "q"
(elliptic curve point octet string) of the key:

string "ed25519"
string "q"

(and also the private key, but this is using the same technique).

Stef

_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Howto read a mpi point from buffer?

Werner Koch
On Sat, 10 Jun 2017 19:55, [hidden email] said:

> The file I want to read is the public key stored by openssh, where the "q"
> (elliptic curve point octet string) of the key:
>
> string "ed25519"
> string "q"

I suggest to read gnupg/agent/command-ssh.c.  In particular the
functions ssh_receive_key and stream_read_blob.  The trick here is that
you don't read a proper MPI but merely use the MPI object to store an
opaque value - the ECC crypto function can handle them.


Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel

attachment0 (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Howto read a mpi point from buffer?

Stef Bon
2017-06-11 14:28 GMT+02:00 Werner Koch <[hidden email]>:
>
> I suggest to read gnupg/agent/command-ssh.c.  In particular the
> functions ssh_receive_key and stream_read_blob.  The trick here is that
> you don't read a proper MPI but merely use the MPI object to store an
> opaque value - the ECC crypto function can handle them.
>

A thanks! I will read that code.
I've found something in the test/t-mpi-point.c code.
The "q" of a sample ed25519 is read using a hex2mpi function, which on
his turn uses the
gcry_mpi_scan function using the GCRYMPI_FMT_HEX format.

Stef

_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Loading...