root/openpgpsdk/trunk/examples/verify.c

Revision 371 (checked in by ben, 7 years ago)

Make sure dmalloc happens last.

Line 
1 #include <openpgpsdk/packet.h>
2 #include <openpgpsdk/packet-parse.h>
3 #include <openpgpsdk/util.h>
4 #include <openpgpsdk/accumulate.h>
5 #include <openpgpsdk/keyring.h>
6 #include <openpgpsdk/validate.h>
7 #include <unistd.h>
8 #include <string.h>
9 #include <fcntl.h>
10
11 #include <openpgpsdk/final.h>
12
13 int main(int argc,char **argv)
14     {
15     ops_parse_info_t *pinfo;
16     ops_keyring_t keyring;
17     const char *target;
18     int fd;
19
20     if(argc != 2)
21         {
22         fprintf(stderr,"%s <file to verify>\n",argv[0]);
23         exit(1);
24         }
25
26     target=argv[1];
27
28     ops_init();
29
30     memset(&keyring,'\0',sizeof keyring);
31
32     pinfo=ops_parse_info_new();
33
34     fd=open(target,O_RDONLY);
35     if(fd < 0)
36         {
37         perror(target);
38         exit(2);
39         }
40     ops_reader_set_fd(pinfo,fd);
41
42     ops_parse_and_accumulate(&keyring,pinfo);
43
44     ops_dump_keyring(&keyring);
45
46     ops_validate_all_signatures(&keyring);
47
48     ops_keyring_free(&keyring);
49
50     ops_finish();
51
52     return 0;
53     }
Note: See TracBrowser for help on using the browser.