Error encrypting string data
Fri, 18 Jul 2003 13:20:24 +0200
On Thu, 17 Jul 2003 13:37:25 +0200, Ralf Schneider said:
> x = gcry_mpi_new (0);
> gcry_mpi_set_opaque (x, text, strlen(text));
You can't use opaque becuase that won't yield a valid MPI which can be
passed to other MPI functions. Opaque is a hack to allow for
encrypted MPI values.
To convert a string into an MPI, use this:
const char string = "Is that all you've got to show for seven "
"and a half million years' work?";
rc = gcry_mpi_scan (&a, GCRYMPI_FMT_USG, string, strlen (string));
bug ("oops: mpi_scan failed: %s\n", gpg_strerror (rc));
However, using this is not secure as proper padding is required for
most public key algorithms; see the HAC for details.
Werner Koch <firstname.lastname@example.org>
The GnuPG Experts http://g10code.com
Free Software Foundation Europe http://fsfeurope.org