Error encrypting string data

Ralf Schneider ralf@tapfere-schneiderleins.de
Mon, 21 Jul 2003 16:06:23 +0200


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

Am Montag, 21. Juli 2003 15:09 schrieb Moritz Schulte:
> Ralf Schneider <ralf@tapfere-schneiderleins.de> writes:
> > I got the iteration over the MPI values of a key working.
>
> How did you extract the data set from a key (without the function I am
> about to commit today)?  Or did you initialize your own key from a
> given data set?

Oh, it's quite a hack :-) I looked into cipher/ac.c and found the definitio=
n=20
of gcry_ac_key and copied it to my source file (I know this is terrible, bu=
t=20
only for testing :-). Then I wrote this loop:

  for (int i =3D 0; i < gcry_ac_data_length(privKey->data); i++)
  {
    gcry_ac_data_get_index (privKey->data, i, (const char **)&pname, &mpi);
    printf ("MPI value %d:   %s", i, pname);
  }

> > It shows 6 MPI values named n, e, d, p, q and u. But what is the
> > meaning of these values? Do they together hold the key?
>
> Yes, these values form the `key'.  The values you mentioned form the
> complete, secret key.  The public key is actually the same, with some
> values left out.  The names and the amount of these MPI values are
> algorithm dependent.

What do I have to do to get the key as a byte array? Convert the single MPI=
=20
values (gcry_mpi_print) and simply concatenate the resulting strings? You=20
remember, I want to encode the key base64 and store it in a database.

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

iD8DBQE/G/Ng7YyyfykA0YkRAtE2AJ9ihVridS1EBV3MRzcZU4uS+QoMfQCeKbJm
WKBnCGmg0bSe8P24CbIS0bA=3D
=3DdLpf
=2D----END PGP SIGNATURE-----