Public Key encryption again

Timo Schulz twoaday@freakmail.de
Sat, 20 Jul 2002 16:31:18 +0200


On Sat Jul 20 2002; 16:00, Rüdiger Sonderfeld wrote:

> hi,
> I modified the code from g10/encode.c but it doesn't work :(

You can download OpenCDK because the interface there is more
general...(http://www.winpt.org/opencdk.html)


> int wcrypt_pkencrypt(enum pkalgo alg,unsigned char *sdata,size_t 

"sdata" should be the session key, right?


>   gcry_mpi_scan(&data,GCRYMPI_FMT_USG/*??*/,sdata,&ndata);
> /*is this correct?*/

This depends on the format of sdata. FMT_USG is used for general
MPI values that are *not* prefixed with the length in the buffer
like (OpenPGP/SSH).


> //!!! what is now the content of resarr[0] and resarr[1]? 
> The encrypted text?

This also depends on your data field. Usually the data should
be the session key and the result is the encrypted session key!


>   gcry_mpi_print(GCRYMPI_FMT_USG/*??*/,to,&nto,resarr[0]);
> //!!! is this the right way to convert the mpi struct to text?

To text? I guess you mean to binary data...but yes it is.


        Timo