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, size_t count, unsigned char *c)
20 return (!write(1, c, count));
24 int main(int argc, char *argv[])
26 struct openpgp_packet_list *packets = NULL;
29 struct openpgp_packet_list *list_end = NULL;
30 struct openpgp_publickey *keys = NULL;
31 struct openpgp_publickey *newkeys = NULL;
34 fputs("Doing read_openpgp_stream():\n", stderr);
35 read_openpgp_stream(getnextchar, ctx, &packets);
37 fputs("Doing dearmor_openpgp_stream():\n", stderr);
38 dearmor_openpgp_stream(getnextchar, NULL, &packets);
39 fputs("Doing armor_openpgp_stream():\n", stderr);
40 armor_openpgp_stream(putnextchar, NULL, packets);
43 fputs("Doing parse_keys():\n", stderr);
44 parse_keys(packets, &keys);
46 printf("Key id is 0x%llX\n", get_keyid(keys));
48 key_index(keys, true, false, false);
51 fetch_key(get_keyid(keys), &newkeys);
54 printf("New key id is 0x%llX\n", get_keyid(newkeys));
56 fputs("Doing flatten_publickey():\n", stderr);
57 flatten_publickey(keys, &newpackets, &list_end);
59 fputs("Doing write_openpgp_stream():\n", stderr);
60 write_openpgp_stream(putnextchar, ctx, newpackets);