format of encrypted data in sexpr

Werner Koch wk at gnupg.org
Tue Jun 2 10:55:24 CEST 2009


On Thu, 28 May 2009 22:42, o.finnendahl at mh-freiburg.de said:

> The gcry_sexp_sprint function below sometimes returns a hex string
> (enclosed with hashmarks) and sometimes a string (enclosed in double
> quotes) in some random order for reasons not immediately obvious to
> me.

That is just a human readable format which uses a heuristic to decide
how to print it out.  See libgcrypt/src/sexp.c:suitable_encoding .

For machine based parsing it is way easier to use the canonical
S-expression format; see http://people.csail.mit.edu/rivest/sexp.html
for details on S-expressions.

>   gcry_sexp_sprint (decr, GCRYSEXP_FMT_ADVANCED,

Use GCRYSEXP_FMT_CANON .  gnupg/common/sexp-parse.h has fucntions to
parse a canonical encoded S-expression.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Auschnahme regelt ein Bundeschgesetz.




More information about the Gcrypt-devel mailing list