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"
19 #include "onak-conf.h"
23 int main(int argc, char *argv[])
25 struct openpgp_packet_list *packets = NULL;
26 struct openpgp_publickey *keys = NULL;
28 struct buffer_ctx ctx;
31 memset(&ctx, 0, sizeof(ctx));
33 params = getcgivars(argc, argv);
34 for (i = 0; params != NULL && params[i] != NULL; i += 2) {
35 if (!strcmp(params[i], "keytext")) {
36 ctx.buffer = params[i+1];
37 ctx.size = strlen(ctx.buffer);
50 start_html("onak : Add");
51 if (ctx.buffer == NULL) {
52 puts("Error: No keytext to add supplied.");
54 dearmor_openpgp_stream(buffer_fetchchar,
57 if (packets != NULL) {
58 parse_keys(packets, &keys);
61 printf("Got %d new keys.\n",
62 update_keys(&keys, false));
65 puts("No OpenPGP packets found in input.");
69 return (EXIT_SUCCESS);