tokenising a sexp, possible without serialisation?

Werner Koch wk at gnupg.org
Tue Jan 5 09:10:15 CET 2010


On Sun, 03 Jan 2010 09:11:28 +0100, Marco Maggi wrote:

>   I am writing a binding for a high-level language; it would
> really  improve  my   API  user-friendliness  to  convert  a
> Gcrypt's sexp into a sexp for the language.

Right.

>   I   would  like   to  do   it  without   converting  first
> "gcry_sexp_t"  to  a  string  in  canon format,  but  is  it
> actually  possible using the  "gcry_sexp_nth_*()" functions?

I am not sure.

I suggest that you indeed first convert to a canonical s-expression
and parse that one.  Here is some overhead right now but eventually
this will go because there are plans to a change the internal
implementation to work directly on canonical s-expressions.

> What I miss is a way to determine if the next item is a tag,
> an MPI or an "unsigned long" (using the public Gcrypt API).

There is no way to do it because the s-expressions are typeless and we
don't implement display hints.  Libgcrypt deduces the type of an item
out of the context.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gcrypt-devel mailing list