summaryrefslogtreecommitdiffstats
path: root/info.c
blob: edcc53ac552260852f4706743fe832ef5c9ffdfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <gpgme.h>

int main (int argc, char *argv[]) {

	gpgme_ctx_t   ctx;
	gpgme_error_t err;
	const char    *ver;
	gpgme_engine_info_t info;

	ver = gpgme_check_version(NULL);
	printf("gpgme version: %s\n", ver);

	err = gpgme_new(&ctx);
	if (err != GPG_ERR_NO_ERROR) {
		printf("** gpgme_new return %d\n", err);
	}
	
	info = gpgme_ctx_get_engine_info(ctx);
	while(info) {
		printf("protocol:%d, file_name:%s\n", info->protocol, info->file_name);
		info = info->next;
	}

	err = gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_OpenPGP, "/usr/bin/gpg", NULL);
	if (err != GPG_ERR_NO_ERROR) {
		printf("** gpgme_ctx_set_engine_info return %d\n", err);
	}

	info = gpgme_ctx_get_engine_info(ctx);
	while(info) {
		printf("protocol:%d, file_name:%s\n", info->protocol, info->file_name);
		info = info->next;
	}
	return 0;
}