gpgme: export key problems

Nico Schottelius nico-linux-gnupg at schottelius.org
Sun Aug 5 00:05:18 CEST 2007


Hello!

I'm new to gpgme and have some understanding problems:

I'm trying to export a key:

--------------------------------------------------------------------------------
err = gpgme_data_new(&data);
err = gpgme_op_export(ceofcontext,NULL,0,data); /* returns no error */
read_bytes = gpgme_data_seek (data, 0, SEEK_END); /* returns -1 */
p = gpgme_strerror(errno); /* returns "Invalid encoding method" */
--------------------------------------------------------------------------------

So I added more code to my test:

--------------------------------------------------------------------------------
setlocale (LC_ALL, "");
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
gpgme_set_textmode(ceofcontext,0);
gpgme_set_armor(ceofcontext, 1);
err = gpgme_data_set_encoding(data,GPGME_DATA_ENCODING_ARMOR);
if(err != GPG_ERR_NO_ERROR) return 11;
tmp = gpgme_data_get_encoding(data);
if(tmp == GPGME_DATA_ENCODING_ARMOR) {
   printf("encode ok\n");  /* matches / is printed out */
}
--------------------------------------------------------------------------------

Still the same error.

Then I tried t-export.c from the test directory from gpgme. Result:

--------------------------------------------------------------------------------
[23:47] denkbrett:gpg% LANG=C ./t-export 
Begin Result:
t-support.h:56: Unspecified source: Invalid argument
--------------------------------------------------------------------------------

I searched for examples for using gpgme, but there seem to be more or
less none available.

Does anyone have a hint for me, what I am doing wrong?

I attached the whole testprogram.

Sincerly

Nico

-- 
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: gpgme1.c
Type: text/x-csrc
Size: 4350 bytes
Desc: not available
Url : /pipermail/attachments/20070805/28f18d03/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : /pipermail/attachments/20070805/28f18d03/attachment.pgp 


More information about the Gnupg-users mailing list