Skip to content

Commit

Permalink
feat(v2): Add flag that can disable intended recipient in signcrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
lubux committed Oct 12, 2023
1 parent d819a77 commit 410d3a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions openpgp/packet/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ type Config struct {
// CheckIntendedRecipients is a flag that indicates if
// a decryption key for an encrypted and signed messages should be checked
// to be present in the signatures intended recipient list.
// In encrypt and sign intended recipients are only included if this flag is true.
// if config is nil or flag is nil, it defaults to true
CheckIntendedRecipients *bool
// CacheSessionKey is a flag that indicates
Expand Down
4 changes: 3 additions & 1 deletion openpgp/v2/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,9 @@ func encrypt(
var intendedRecipients []*packet.Recipient
// Intended Recipient Fingerprint subpacket SHOULD be used when creating a signed and encrypted message
for _, publicRecipient := range to {
intendedRecipients = append(intendedRecipients, &packet.Recipient{KeyVersion: publicRecipient.PrimaryKey.Version, Fingerprint: publicRecipient.PrimaryKey.Fingerprint})
if config.IntendedRecipients() {
intendedRecipients = append(intendedRecipients, &packet.Recipient{KeyVersion: publicRecipient.PrimaryKey.Version, Fingerprint: publicRecipient.PrimaryKey.Fingerprint})
}
}

timeForEncryptionKey := config.Now()
Expand Down

0 comments on commit 410d3a5

Please sign in to comment.