Skip to content

Commit

Permalink
Fix armoring signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Nov 22, 2024
1 parent fbe5a9e commit 0604c19
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmd/armor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,21 @@ func armorDecidingType(input []byte) (armored string, err error) {
return armorKeys(input, constants.PrivateKeyHeader)
}
if _, ok := p.(*packet.Signature); ok {
armored, err = armor.ArmorPGPSignature(input)
if err != nil {
return armored, err
// If every packet is a signature packet, armor the input as a
// signature; otherwise, armor it as a message.
for {
if p, err = packets.Next(); err == io.EOF {
return armor.ArmorPGPSignature(input)
}
if err != nil {
break
}
if _, ok := p.(*packet.Signature); !ok {
break
}
}
}
armored, err = armor.ArmorPGPMessage(input)
return armored, err
return armor.ArmorPGPMessage(input)
}

func armorKeys(input []byte, armorType string) (armored string, err error) {
Expand Down

0 comments on commit 0604c19

Please sign in to comment.