Skip to content

Commit

Permalink
remove exportable property from signature (allow parsing only)
Browse files Browse the repository at this point in the history
  • Loading branch information
dedekind125 committed Apr 9, 2024
1 parent 640b1d1 commit 5a5dcd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 0 additions & 6 deletions openpgp/packet/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ type Signature struct {
Notations []*Notation
IntendedRecipients []*Recipient

// Exportable is a flag to indicate whenether certification signature is exportable.
// See RFC 4880, section 5.2.3.11 for details.
Exportable *bool

// TrustLevel and TrustAmount can be set by the signer to assert that
// the key is not only valid but also trustworthy at the specified
// level.
Expand Down Expand Up @@ -428,8 +424,6 @@ func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (r
err = errors.UnsupportedError("signature with non-exportable certification")
return
}
sig.Exportable = new(bool)
*sig.Exportable = true
case trustSubpacket:
if len(subpacket) != 2 {
err = errors.StructuralError("trust subpacket with bad length")
Expand Down
10 changes: 3 additions & 7 deletions openpgp/packet/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,20 @@ func TestSignatureWithTrustAndRegex(t *testing.T) {
}
}

func TestSignatureWithExportableCert(t *testing.T) {
func TestCanParseSignatureWithExportableCert(t *testing.T) {
packet, err := Read(readerFromHex(signatureWithExportableCertHex))
if err != nil {
t.Error(err)
return
}

sig, ok := packet.(*Signature)
_, ok := packet.(*Signature)
if !ok {
t.Errorf("failed to parse, got: %#v", packet)
}

if !*sig.Exportable {
t.Errorf("expected signature exportable flag to be true")
}
}

func TestSignatureWithNonExportableCert(t *testing.T) {
func TestCannotParseSignatureWithNonExportableCert(t *testing.T) {
_, err := Read(readerFromHex(signatureWithNonExportableCertHex))
if err == nil {
t.Errorf("did not receive an error when expected")
Expand Down

0 comments on commit 5a5dcd1

Please sign in to comment.