Error encrypting string data
Ralf Schneider
ralf@tapfere-schneiderleins.de
Sat, 19 Jul 2003 10:37:51 +0200
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Freitag, 18. Juli 2003 13:20 schrieb Werner Koch:
> To convert a string into an MPI, use this:
>
> gcry_mpi_t a;
> int rc;
> const char string[] =3D "Is that all you've got to show for seven "
> "and a half million years' work?";
>
> rc =3D gcry_mpi_scan (&a, GCRYMPI_FMT_USG, string, strlen (string));
> if (rc)
> bug ("oops: mpi_scan failed: %s\n", gpg_strerror (rc));
>
> foo (a)
> gcry_mpi_release (a);
>
Hi Werner,
thank you very much for your code snippet. After a small correction=20
(gcry_mpi_scan expects a pointer to size_t instead of a size_t value) it=20
worked fine.
Now, I have another conversion problem :-) I want to store the keys I gener=
ate=20
with gcry_ac_key_pair_generate in a database. My idea was to encode them=20
base64 and store them in a VARCHAR field.=20
So, the problem is: How can I convert the key of type gcry_ac_key_t to a=20
representation that I can encode to a base64 string (for example a byte=20
array)?
> However, using this is not secure as proper padding is required for
> most public key algorithms; see the HAC for details.
What is the HAC? Where can I find it?
Best regards,
Ralf.
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/GQNk7YyyfykA0YkRAkdnAJwOleuEfInVTpcZVXu4NO3UOJMhugCfahce
QxxzEYTEdnn83hBs+futHis=3D
=3D211g
=2D----END PGP SIGNATURE-----