How to use it

Moritz Schulte moritz@duesseldorf.ccc.de
Wed, 16 Jul 2003 15:20:58 +0200


Ralf Schneider <ralf@tapfere-schneiderleins.de> writes:

> What is the best way to store keys in a database? base64 encoded in
> a VARCHAR field?

I am not sure, but this sounds reasonable in my opinion.

> I tried the following sequence for storing a string in a MPI value, but I get 
> a segmentation fault with the gcry_mpi_print call:
>
>   char text[1024] = "This is a test string.";
[...]
>   gcry_mpi_scan  (&x, GCRYMPI_FMT_HEX, text, &textlen);

Well, since "This is a test string." is not a valid number in Hex
format, this does not work.

> I looked into encode.c, but could not identify a place where a
> string is encoded to a MPI value.

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.

		moritz
-- 
((gpg-key-id . "6F984199")
 (email      . "moritz@duesseldorf.ccc.de")
 (webpage    . "http://duesseldorf.ccc.de/~moritz/"))