2 * add.c - CGI to add keys.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2002 Project Purple
15 #include "charfuncs.h"
18 #include "keystructs.h"
22 #include "onak-conf.h"
26 int main(int argc, char *argv[])
28 struct openpgp_packet_list *packets = NULL;
29 struct openpgp_publickey *keys = NULL;
31 struct buffer_ctx ctx;
34 memset(&ctx, 0, sizeof(ctx));
36 params = getcgivars(argc, argv);
37 for (i = 0; params != NULL && params[i] != NULL; i += 2) {
38 if (!strcmp(params[i], "keytext")) {
39 ctx.buffer = params[i+1];
40 ctx.size = strlen(ctx.buffer);
53 start_html("onak : Add");
54 if (ctx.buffer == NULL) {
55 puts("Error: No keytext to add supplied.");
58 initlogthing("add", config.logfile);
59 dearmor_openpgp_stream(buffer_fetchchar,
62 if (packets != NULL) {
63 parse_keys(packets, &keys);
65 printf("Got %d new keys.\n",
74 puts("No OpenPGP packets found in input.");
80 return (EXIT_SUCCESS);