Error encrypting string data

Ralf Schneider ralf@tapfere-schneiderleins.de
Mon, 21 Jul 2003 11:34:31 +0200


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

Am Montag, 21. Juli 2003 10:04 schrieb Werner Koch:
> > So, the problem is: How can I convert the key of type gcry_ac_key_t to a
> > representation that I can encode to a base64 string (for example a byte
> > array)?
>
> Look for gcry_mpi_print or gcry_mpi_aprint.  Use GCRY_FMT_PGP if you
> want a 2 bytes header with the number of bits following or
> GCRY_FMT_SSH with a 4 byte header with the number of bytes follwoing
> or simply GCRY_FMT_STD with no header.  There is also GCRY_FMT_HEX
> which prints each byte as 2 hex digits.

Ok, but gcry_mpi_print takes a parameter of type gcry_mpi_t and the key is =
of=20
type gcry_ac_key_t. I tried to simply convert the key to gcry_mpi_t but thi=
s=20
results in a segementation fault :-( So, how can I convert a gcry_ac_key to=
 a=20
gcry_mpi?

BTW: Where is struct gcry_ac_key defined? I didn't find the definition of t=
his=20
structure in the sources.

> > What is the HAC? Where can I find it?
>
> Handbook of Applied Cryptography.  Since some time entirely available
> online:  http://cacr.math.uwaterloo.ca/hac/

I have a german edition of Bruce Schneier's "Applied Cryptographie" which i=
s a=20
little bit easier to understand for me :-) I read the chapter about public=
=20
key algorithms and the problem of a small encryption exponent.

If I understood this right, the problem only arises when I have several=20
identical messages, right? So, if the plain text is always different, there=
's=20
no problem.

But how can this padding be done? By appending a fix number of random bytes=
=20
(for example always 20 bytes) to the plain text that can be easily removed=
=20
when decryting the cipher text?

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

iD8DBQE/G7On7YyyfykA0YkRAtORAKCHyEantuIzXZFCOsWtj7aTA3I1hACfQ59z
Kduj+u6eTg5378FnlTuIo0Y=3D
=3DNsYT
=2D----END PGP SIGNATURE-----