有沒有辦法不導入用戶的鑰匙圈
爲了防止加載用戶的鑰匙圈,你將需要設置的背景搬到別的地方去的GnuPG的主目錄。
下面是沒有任何錯誤校驗的例子
#include <gpgme.h>
#include <locale.h>
int main() {
gpgme_ctx_t ctx; // the context
gpgme_error_t err; // errors
gpgme_key_t key; // the key
gpgme_keylist_result_t result; // the keylist results
setlocale (LC_ALL, ""); // set the locale
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); // set gpgme locale
gpgme_check_version(NULL); // initialize gpgme
gpgme_new (&ctx); // initialize the context
gpgme_ctx_set_engine_info (ctx, GPGME_PROTOCOL_OpenPGP, NULL, "/tmp/xyz"); // set the context GNUPGHOME to "/tmp/xyz"
gpgme_op_keylist_start (ctx, NULL, 0); // start the keylist
while (!(err = gpgme_op_keylist_next (ctx, &key))) { // loop through the keys in the keyring
fprintf(stdout, "Key ID: %s\n", key->subkeys->keyid); // print out the keyid
gpgme_key_unref (key); // release the key reference
}
gpgme_release(ctx); // release the context, all done
return 0;
}
'gpgme_ctx_set_engine_info(CTX,GPGME_PROTOCOL_OpenPGP,NULL, 「/ TMP/XYZ」);'實際打破它並且沒有線路它像正常 – 735Tesla
@ 735Tesla - 究竟是什麼突破? – kylehuff
它不會產生任何輸出。我得到的錯誤說它沒有被初始化。 – 735Tesla