]> the.earth.li Git - onak.git/commitdiff
Add support for issuer fingerprint subpackets
authorJonathan McDowell <noodles@earth.li>
Mon, 15 Apr 2019 09:22:12 +0000 (10:22 +0100)
committerJonathan McDowell <noodles@earth.li>
Mon, 15 Apr 2019 09:22:12 +0000 (10:22 +0100)
A new subpacket containing the entire fingerprint of the signature
issuer has been added in RFC4880bis. This improves the old issuer keyid
subpacket type.

decodekey.c
openpgp.h

index 0ff0625929849713a2597bf36769f009badab90c..8e7d54481d96250d739b46d7466ead1c78b328ea 100644 (file)
@@ -48,6 +48,8 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len,
        int offset = 0;
        int length = 0;
        int packetlen = 0;
+       struct openpgp_fingerprint fp;
+       int i;
 
        assert(data != NULL);
 
@@ -122,6 +124,16 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len,
                                *keyid += data[offset+packetlen - 1];
                        }
                        break;
+               case OPENPGP_SIGSUB_ISSUER_FINGER:
+                       if ((packetlen - 2) <= MAX_FINGERPRINT_LEN &&
+                                       keyid != NULL) {
+                               fp.length = packetlen - 2;
+                               for (i = 0; i < fp.length; i++) {
+                                       fp.fp[i] = data[offset + i + 2];
+                               }
+                               *keyid = fingerprint2keyid(&fp);
+                       }
+                       break;
                case OPENPGP_SIGSUB_EXPIRY:
                case OPENPGP_SIGSUB_EXPORTABLE:
                case OPENPGP_SIGSUB_TRUSTSIG:
@@ -134,7 +146,7 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len,
                case OPENPGP_SIGSUB_REVOCATION_KEY:
                case OPENPGP_SIGSUB_ISSUER_UID:
                case OPENPGP_SIGSUB_URL:
-               case OPENPGP_SIGSUB_ISSUER_FINGER:
+               case OPENPGP_SIGSUB_X_ISSUER_FINGER:
                case OPENPGP_SIGSUB_NOTATION:
                case OPENPGP_SIGSUB_PREFHASH:
                case OPENPGP_SIGSUB_PREFCOMPRESS:
index 73a6f38ed67cab28449f7649643b926302d86ec0..768a6f251171fdd172dc35924f38cbd5df8d9ad9 100644 (file)
--- a/openpgp.h
+++ b/openpgp.h
 #define OPENPGP_SIGSUB_ISSUER          16
 #define OPENPGP_SIGSUB_ISSUER_UID      17      /* Legacy */
 #define OPENPGP_SIGSUB_URL             18      /* Legacy */
-#define OPENPGP_SIGSUB_ISSUER_FINGER   19      /* Legacy */
+#define OPENPGP_SIGSUB_X_ISSUER_FINGER 19      /* Legacy */
 #define OPENPGP_SIGSUB_NOTATION                20
 #define OPENPGP_SIGSUB_PREFHASH                21
 #define OPENPGP_SIGSUB_PREFCOMPRESS    22
 #define OPENPGP_SIGSUB_FEATURES                30
 #define OPENPGP_SIGSUB_SIGNATURE_TARGET        31
 #define OPENPGP_SIGSUB_EMBEDDED_SIG    32
+#define OPENPGP_SIGSUB_ISSUER_FINGER   33
 
 #endif /* __OPENPGP_H__ */