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"
21 #include "onak-conf.h"
25 int main(int argc, char *argv[])
27 struct openpgp_packet_list *packets = NULL;
28 struct openpgp_publickey *keys = NULL;
30 struct buffer_ctx ctx;
33 memset(&ctx, 0, sizeof(ctx));
35 params = getcgivars(argc, argv);
36 for (i = 0; params != NULL && params[i] != NULL; i += 2) {
37 if (!strcmp(params[i], "keytext")) {
38 ctx.buffer = params[i+1];
39 ctx.size = strlen(ctx.buffer);
52 start_html("onak : Add");
53 if (ctx.buffer == NULL) {
54 puts("Error: No keytext to add supplied.");
56 dearmor_openpgp_stream(buffer_fetchchar,
59 if (packets != NULL) {
60 parse_keys(packets, &keys);
63 printf("Got %d new keys.\n",
64 update_keys(&keys, false));
72 puts("No OpenPGP packets found in input.");
76 return (EXIT_SUCCESS);