Using libgcrypt outside of gpg

Spencer Ogden spencero@mail.utexas.edu
Sat, 3 May 2003 13:20:12 -0500


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