gcry_sexp_nth_data and gcry_pk_decrypt

Ahmad Fatoum ahmad at a3f.at
Fri Aug 18 03:10:44 CEST 2017

Hello everyone,

I am wondering whether following snippet is correct:

        rc = gcry_sexp_build(&s_data, NULL, "(enc-val(rsa(a%b)))", (int)len, (char*)data);
	assert(rc == 0);
        rc = gcry_pk_decrypt(&s_plain, s_data, pk);
	assert(rc == 0);
	const char *decr = gcry_sexp_nth_data(s_plain, 0, &decr_len);
        /* do something with the plaintext in decr */

It seems to work, but there has been doubt whether accessing the plaintext with gcry_sexp_nth_data and index 0
is always guaranteed to work (No endianness issues for example):

Help would be appreciated. Thanks.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: </pipermail/attachments/20170818/c41b224d/attachment.sig>

More information about the Gcrypt-devel mailing list