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