Error encrypting string data

Ralf Schneider ralf@tapfere-schneiderleins.de
Mon, 21 Jul 2003 13:48:59 +0200


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

Am Montag, 21. Juli 2003 13:03 schrieb Werner Koch:
> On Mon, 21 Jul 2003 11:34:31 +0200, Ralf Schneider said:
> > Ok, but gcry_mpi_print takes a parameter of type gcry_mpi_t and the key
> > is of type gcry_ac_key_t. I tried to simply convert the key to gcry_mpi=
_t
> > but this results in a segementation fault :-( So, how can I convert a
> > gcry_ac_key to a
>
> The AC interface is pretty new;  Moritz can give you some hints.

OK, Moritz, would you be so kind to give me a hint how to convert a key to =
an=20
MPI value?

I tried this:

  if (gcry_ac_key_pair_generate (hd, &keyPair, 1024, (void *)0))
  {
	...
  }
 =20
  privKey =3D gcry_ac_key_pair_extract (keyPair, GCRY_AC_KEY_SECRET);
  pubKey  =3D gcry_ac_key_pair_extract (keyPair, GCRY_AC_KEY_PUBLIC);

  char  key[2048];
  size_t keylen =3D 2048;
 =20
  if (gcry_mpi_print (GCRYMPI_FMT_PGP, key, &keylen, (gcry_mpi_t)privKey))
  {
	...
  }

But the call of gcry_mpi_print generates a segmentation fault. How can the=
=20
conversion be done?

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

iD8DBQE/G9Mt7YyyfykA0YkRAtVKAJ0SyTbm2pBRB+lzZEwhvAFJn8eI6ACeLF5z
=463/7v/xPXneqWCodRlJn2gU=3D
=3DNIaG
=2D----END PGP SIGNATURE-----