Skip to content

Commit 196c8f5

Browse files
authored
Allow parsing empty Key Flags subpackets (#214)
This is allowed by the spec, which says: > This subpacket contains a list of binary flags that hold information > about a key. It is a string of octets, and an implementation MUST NOT > assume a fixed size. This is so it can grow over time. If a list is > shorter than an implementation expects, the unstated flags are > considered to be zero. And it can be useful to explicitly say that a primary key is not allowed to be used for any purpose (except certifying subkeys), for example.
1 parent c25e074 commit 196c8f5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

openpgp/packet/signature.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,10 @@ func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (r
518518
}
519519
case keyFlagsSubpacket:
520520
// Key flags, section 5.2.3.21
521+
sig.FlagsValid = true
521522
if len(subpacket) == 0 {
522-
err = errors.StructuralError("empty key flags subpacket")
523523
return
524524
}
525-
sig.FlagsValid = true
526525
if subpacket[0]&KeyFlagCertify != 0 {
527526
sig.FlagCertify = true
528527
}

0 commit comments

Comments
 (0)