10 #include "keystructs.h"
13 int getnextchar(void *ctx, size_t count, unsigned char *c)
15 return (!read(0, c, count));
18 int putnextchar(void *ctx, unsigned char c)
20 return (!write(1, &c, 1));
24 int main(int argc, char *argv[])
26 struct openpgp_packet_list *packets = NULL, *newpackets = NULL;
27 struct openpgp_packet_list *list_end = NULL;
28 struct openpgp_publickey *keys = NULL;
29 struct openpgp_publickey *newkeys = NULL;
32 fputs("Doing read_openpgp_stream():\n", stderr);
33 read_openpgp_stream(getnextchar, ctx, &packets);
35 // fputs("Doing dearmor_openpgp_stream():\n", stderr);
36 // dearmor_openpgp_stream(getnextchar, NULL, &packets);
37 // fputs("Doing armor_openpgp_stream():\n", stderr);
38 // armor_openpgp_stream(putnextchar, NULL, packets);
40 fputs("Doing parse_keys():\n", stderr);
41 parse_keys(packets, &keys);
43 printf("Key id is 0x%llX\n", get_keyid(keys));
45 // key_index(keys, true, false, false);
48 fetch_key(get_keyid(keys), &newkeys);
51 printf("New key id is 0x%llX\n", get_keyid(newkeys));
53 // fputs("Doing flatten_publickey():\n", stderr);
54 // flatten_publickey(keys, &newpackets, &list_end);
56 // fputs("Doing write_openpgp_stream():\n", stderr);
57 // write_openpgp_stream(putnextchar, ctx, newpackets);