root/openpgpsdk/trunk/examples/create-key.c

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

Make sure dmalloc happens last.

Line 
1 #include <openpgpsdk/create.h>
2 #include <openpgpsdk/util.h>
3 #include <stdio.h>
4
5 #include <openpgpsdk/final.h>
6
7 int main(int argc,char **argv)
8     {
9     ops_create_info_t *info;
10     const unsigned char *id;
11     const char *nstr;
12     const char *estr;
13     BIGNUM *n=NULL;
14     BIGNUM *e=NULL;
15
16     if(argc != 4)
17         {
18         fprintf(stderr,"%s <n> <e> <user id>\n",argv[0]);
19         exit(1);
20         }
21    
22     nstr=argv[1];
23     estr=argv[2];
24     id=(unsigned char *)argv[3];
25
26     BN_hex2bn(&n,nstr);
27     BN_hex2bn(&e,estr);
28
29     info=ops_create_info_new();
30     ops_writer_set_fd(info,1);
31
32     ops_write_rsa_public_key(time(NULL),n,e,info);
33     ops_write_user_id(id,info);
34
35     ops_create_info_delete(info);
36
37     return 0;
38     }
Note: See TracBrowser for help on using the browser.