Mailing List Archive

Using libgcrypt outside of gpg
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.

I am attempting to inorporate libgcrypt public key functions into a kernel
module for linux 2.4. This is a proof of concept exercise for a class, so I
am not concerned with whether it is truly secure or not. I have gotten
everything to compile down to a kernel module and things seem to be reacting
reasonably.

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.

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.

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? Should I pass the
whole thing, including the dashed header and footer, or just the characters
contained? Am I way of based? Any help is appreciated.

Spencer
Re: Using libgcrypt outside of gpg [ In reply to ]
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