Clean up file header copyrights
[onak.git] / decodekey.c
index 3a6e075d53544882425981dbac7bce034b5c7817..0b72e5b918699c98414863e64bb3e322d078bd21 100644 (file)
@@ -1,9 +1,20 @@
 /*
  * decodekey.c - Routines to further decode an OpenPGP key.
  *
- * Jonathan McDowell <noodles@earth.li>
+ * Copyright 2002-2008 Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2002 Project Purple
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <stdbool.h>
@@ -18,6 +29,7 @@
 #include "keystructs.h"
 #include "ll.h"
 #include "log.h"
+#include "openpgp.h"
 
 /*
  *     parse_subpackets - Parse the subpackets of a Type 4 signature.
@@ -56,7 +68,7 @@ int parse_subpackets(unsigned char *data, uint64_t *keyid, time_t *creation)
                        packetlen = data[offset++];
                }
                switch (data[offset] & 0x7F) {
-               case 2:
+               case OPENPGP_SIGSUB_CREATION:
                        /*
                         * Signature creation time.
                         */
@@ -70,12 +82,17 @@ int parse_subpackets(unsigned char *data, uint64_t *keyid, time_t *creation)
                                *creation = data[offset + packetlen - 1];
                        }
                        break;
-               case 3:
+               case OPENPGP_SIGSUB_EXPIRY:
                        /*
                         * Signature expiration time. Might want to output this?
                         */
                        break;
-               case 16:
+               case OPENPGP_SIGSUB_REGEX:
+                       /*
+                        * Regular expression for UIDs this sig is over.
+                        */
+                       break;
+               case OPENPGP_SIGSUB_ISSUER:
                        if (keyid != NULL) {
                                *keyid = data[offset+packetlen - 8];
                                *keyid <<= 8;
@@ -94,22 +111,27 @@ int parse_subpackets(unsigned char *data, uint64_t *keyid, time_t *creation)
                                *keyid += data[offset+packetlen - 1];
                        }
                        break;
-               case 20:
+               case OPENPGP_SIGSUB_NOTATION:
                        /*
                         * Annotation data.
                         */
                        break;
 
-               case 23:
+               case OPENPGP_SIGSUB_KEYSERVER:
                        /*
                         * Key server preferences. Including no-modify.
                         */
                        break;
-               case 25:
+               case OPENPGP_SIGSUB_PRIMARYUID:
                        /*
                         * Primary UID.
                         */
                        break;
+               case OPENPGP_SIGSUB_POLICYURI:
+                       /*
+                        * Policy URI.
+                        */
+                       break;
                default:
                        /*
                         * We don't care about unrecognized packets unless bit
@@ -268,7 +290,7 @@ char **keyuids(struct openpgp_publickey *key, char **primary)
                curuid = key->uids;
                while (curuid != NULL) {
                        buf[0] = 0;
-                       if (curuid->packet->tag == 13) {
+                       if (curuid->packet->tag == OPENPGP_PACKET_UID) {
                                snprintf(buf, 1023, "%.*s",
                                                (int) curuid->packet->length,
                                                curuid->packet->data);