How to use it

Ralf Schneider ralf@tapfere-schneiderleins.de
Wed, 16 Jul 2003 16:23:20 +0200


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Mittwoch, 16. Juli 2003 15:20 schrieb Moritz Schulte:
> I just noticed that GnuPG does it different - well, but basically it's
> quite similar. ;-) I have not used the functions before, but the
> descriptions of gcry_mpi_{set,get}_opaque look exactly like what you
> need.

OK, my example works with gcry_mpi_{set,get}_opaque. I then tried to encryp=
t=20
and decrypt the string with this sequence:

  char text[] =3D "Dies ist ein Test-String.";
 =20
  x =3D gcry_mpi_new (0);
  gcry_mpi_set_opaque (x, text, strlen(text));

  if (gcry_ac_data_encrypt (hd, GCRY_AC_FLAG_DATA_NO_BLINDING, pubKey, x,=20
&data))
  {
    ...
  }

  if (gcry_ac_data_decrypt (hd, GCRY_AC_FLAG_DATA_NO_BLINDING, privKey, &x2=
,=20
data))
  {
    ...
  }

  char buf[1024];
  size_t buflen =3D 1024;

  strcpy (buf, (const char *)gcry_mpi_get_opaque (x, &buflen));
  printf (buf);

This is very similar to the sequence in tests/ac.c, but I get a strange err=
or=20
when encrypting the data:

Ohhhh jeeee: ... this is a bug (sexp.c:1046:sexp_sscan)

Any ideas?

Best regards,
Ralf.
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/FV/Y7YyyfykA0YkRAiMCAJ97y4G7CtZuDfb8vnubAQW7GI8PLQCgjXsW
udP8EJdziYs5TNTHUNC4NyM=3D
=3DX/Bl
=2D----END PGP SIGNATURE-----