gpgme_data_new_from_mem works, gpgme_data_write doesn't
Nico Schottelius
nico-gnupg-dev-0 at schottelius.org
Mon Jul 7 00:10:10 CEST 2008
Hello!
I am testing around with gpgme and it seems I am doing something
wrong with gpgme_data_write():
If I do
gerr = gpgme_data_new(&g_test);
if(gerr != GPG_ERR_NO_ERROR) return 20;
i = strlen(b_encrypt);
/* THIS WORKS */
gerr = gpgme_data_new_from_mem(&g_encrypt_send, b_encrypt, i, 1);
if(gerr != GPG_ERR_NO_ERROR) return 24;
/* decrypt: from gpgme_data_new_from_mem() */
gerr = gpgme_op_decrypt(g_context, g_encrypt_send, g_plain_recv);
if(gerr != GPG_ERR_NO_ERROR) {
printf("gerr=%d\n",gerr);
return 19;
}
it works. If I do
gerr = gpgme_data_new(&g_test);
if(gerr != GPG_ERR_NO_ERROR) return 20;
i = strlen(b_encrypt);
printf("strlen(%s) = %d\n",b_encrypt,i);
/* THIS DOES NOT WORK */
tmp = gpgme_data_write(g_test, b_encrypt, i);
printf("gpgmedatawrite: %d\n", tmp);
/* decrypt: from gpgme_data_write() */
gerr = gpgme_op_decrypt(g_context, g_test, g_plain_recv2);
if(gerr != GPG_ERR_NO_ERROR) {
printf("gerr=%d\n",gerr);
return 41;
}
it does *NOT* work.
I created a testfile, containing both cases to show it in
commit 86f3d41a53834231eea54da750bd4564c9c13ae0 of ceofhack.
Anyone a hint, what I am doing wrong in the latter case?
Sincerly
Nico
PS: http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=EOF/ceofhack;a=summary
--
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/
PGP: BFE4 C736 ABE5 406F 8F42 F7CF B8BE F92A 9885 188C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: </pipermail/attachments/20080707/4db0c922/attachment.pgp>
More information about the Gnupg-devel
mailing list