Using libgcrypt outside of gpg

Moritz Schulte moritz@duesseldorf.ccc.de
Tue, 06 May 2003 23:17:35 +0200


Spencer Ogden <spencero@mail.utexas.edu> writes:

Hi,

> Based on the archive I may be out of luck, libgcrypt does not seem
> to be support of development besdes supporting gpg, but here it
> goes.

Well, as far as I can tell, libgcrypt is supposed to be some kind of
general cryptographic library, which should not be _specific_ to GnuPG
[of course the requirements of GnuPG do influence libgcrypt].

> My problem is the lack of documentation for the public key
> functions. I would have no problem writing this documentation as Igo
> along, but I am having trouble discerning proper use from the
> source.

What parts exactly are you missing?  The manual [see doc/gcrypt.info]
does contain a chapter on the Public Key functions.

> My first task is creating a new s-exp with a key and testing the
> sanity of that key. From the source it would seem I can pass the key
> to gcryp_sexp_new as an ASCII string by setting length to 0 and auto
> detect to 1. This is not working, fails with error 201,
> GCRYERR_SEXP_INV_LEN_SPEC, which seems to come from the underlying
> sexp_sscan function.

I can't tell what you are doing wrong.  Did you have a look at
e.g. tests/keygen.c?  That file also shows a bit how to deal with
S-Expressions.

> So my question is, Is it possible to use the mentioned functions to
> create a sexp with a public key as output from gpg ascii-armoured?

I don't think libgcrypt is able to parse the OpenPGP format.

		moritz
-- 
moritz@duesseldorf.ccc.de - http://duesseldorf.ccc.de/~moritz/
GPG fingerprint = 3A14 3923 15BE FD57 FC06  B501 0841 2D7B 6F98 4199