Public Key encryption

Timo Schulz twoaday@freakmail.de
Sun, 16 Jun 2002 17:22:23 +0200


On Sun Jun 16 2002; 16:48, Rüdiger Sonderfeld wrote:

> >     if( algo == GCRY_PK_ELG || algo == GCRY_PK_ELG_E ) {
> >         rc = gcry_sexp_build ( &s_pkey, NULL,
> >                               "(public-key(elg(p%m)(g%m)(y%m)))",
> >                                   pkey[0], pkey[1], pkey[2] );
> >     }
> 
> But what means this? what ist pkey?

pkey is the MPI array (GCRY_MPI). It has the same order that is
required by the gcrypt public scheme (for RSA n, e).

 
> rc = gcry_sexp_build ( &s_pkey, NULL,
>                                "(public-key(rsa(p%m)(g%m)(y%m)))",
>                                    pkey[0], pkey[1], pkey[2] );

No.

For RSA you've to use this:

gcry_sexp_build( &s_pkey, NULL, "(public-key(rsa(n%m)(e%m)))",
                        pkey[0] /* n */, pkey[1] /* e */ );


        Timo