From db2db2c2cd366696183a2d3cf6fea63eb679e54c Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Thu, 18 Jul 2024 13:44:40 +0200 Subject: [PATCH] Update go-crypto --- crypto/encryption_handle.go | 4 ++-- crypto/encryption_session.go | 4 ++-- crypto/key.go | 4 ++-- crypto/key_test.go | 4 ++-- crypto/keyring.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crypto/encryption_handle.go b/crypto/encryption_handle.go index b58851e8..9cbbcabe 100644 --- a/crypto/encryption_handle.go +++ b/crypto/encryption_handle.go @@ -166,7 +166,7 @@ func (eh *encryptionHandle) armorChecksumRequired() bool { checkTime := eh.clock() if eh.Recipients != nil { for _, recipient := range eh.Recipients.entities { - primarySelfSignature, err := recipient.PrimarySelfSignature(checkTime) + primarySelfSignature, err := recipient.PrimarySelfSignature(checkTime, encryptionConfig) if err != nil { return true } @@ -177,7 +177,7 @@ func (eh *encryptionHandle) armorChecksumRequired() bool { } if eh.HiddenRecipients != nil { for _, recipient := range eh.HiddenRecipients.entities { - primarySelfSignature, err := recipient.PrimarySelfSignature(checkTime) + primarySelfSignature, err := recipient.PrimarySelfSignature(checkTime, encryptionConfig) if err != nil { return true } diff --git a/crypto/encryption_session.go b/crypto/encryption_session.go index ddb0271c..0398894d 100644 --- a/crypto/encryption_session.go +++ b/crypto/encryption_session.go @@ -34,7 +34,7 @@ Loop: ek = p unverifiedEntities := keyRing.entities.EntitiesById(p.KeyId) for _, unverifiedEntity := range unverifiedEntities { - keys := unverifiedEntity.DecryptionKeys(p.KeyId, time.Time{}) + keys := unverifiedEntity.DecryptionKeys(p.KeyId, time.Time{}, &packet.Config{}) for _, key := range keys { priv := key.PrivateKey if priv.Encrypted { @@ -118,7 +118,7 @@ func encryptSessionKeyToWriter( if !ok { return errors.New("gopenpgp: encryption key is unavailable for key id " + strconv.FormatUint(e.PrimaryKey.KeyId, 16)) } - primarySelfSignature, _ := e.PrimarySelfSignature(date) + primarySelfSignature, _ := e.PrimarySelfSignature(date, config) if primarySelfSignature == nil { return errors.Wrap(err, "gopenpgp: entity without a self-signature") } diff --git a/crypto/key.go b/crypto/key.go index df5669a9..b9fdcd17 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -289,7 +289,7 @@ func (key *Key) CanEncrypt(unixTime int64) bool { // IsExpired checks whether the key is expired. func (key *Key) IsExpired(unixTime int64) bool { current := time.Unix(unixTime, 0) - sig, err := key.entity.PrimarySelfSignature(time.Time{}) + sig, err := key.entity.PrimarySelfSignature(time.Time{}, &packet.Config{}) if err != nil { return true } @@ -360,7 +360,7 @@ func (key *Key) Check() (bool, error) { // PrintFingerprints is a debug helper function that prints the key and subkey fingerprints. func (key *Key) PrintFingerprints() { for _, subKey := range key.entity.Subkeys { - binding, err := subKey.LatestValidBindingSignature(time.Time{}) + binding, err := subKey.LatestValidBindingSignature(time.Time{}, &packet.Config{}) if err != nil { continue } diff --git a/crypto/key_test.go b/crypto/key_test.go index 5bf7a597..44510c5b 100644 --- a/crypto/key_test.go +++ b/crypto/key_test.go @@ -350,7 +350,7 @@ func TestGetEntity(t *testing.T) { t.Fatal("Cannot unarmor key:", err) } entity := publicKey.GetEntity() - selfSig, err := entity.PrimarySelfSignature(time.Unix(testTime, 0)) + selfSig, err := entity.PrimarySelfSignature(time.Unix(testTime, 0), &packet.Config{}) if err != nil { t.Fatal("Expected no error, got: ", err) } @@ -415,7 +415,7 @@ func TestUnlockMismatchingKey(t *testing.T) { } func TestKeyCompression(t *testing.T) { - selfSig, err := keyTestEC.entity.PrimarySelfSignature(time.Time{}) + selfSig, err := keyTestEC.entity.PrimarySelfSignature(time.Time{}, &packet.Config{}) if err != nil { t.Fatal("no error expected, got: ", err) } diff --git a/crypto/keyring.go b/crypto/keyring.go index ec4098ea..35d01333 100644 --- a/crypto/keyring.go +++ b/crypto/keyring.go @@ -153,7 +153,7 @@ func (keyRing *KeyRing) CountDecryptionEntities(unixTime int64) int { checkTime = time.Unix(unixTime, 0) } for _, entity := range keyRing.entities { - decryptionKeys := entity.DecryptionKeys(0, checkTime) + decryptionKeys := entity.DecryptionKeys(0, checkTime, &packet.Config{}) count += len(decryptionKeys) } return count @@ -249,7 +249,7 @@ func FilterExpiredKeys(contactKeys []*KeyRing) (filteredKeys []*KeyRing, err err hasExpired := false hasUnexpired := false for _, subkey := range entity.Subkeys { - latestValid, err := subkey.LatestValidBindingSignature(now) + latestValid, err := subkey.LatestValidBindingSignature(now, &packet.Config{}) if err != nil { hasExpired = true } diff --git a/go.mod b/go.mod index 3ca87ef5..bde9876f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ProtonMail/gopenpgp/v3 go 1.17 require ( - github.com/ProtonMail/go-crypto v1.1.0-alpha.4 + github.com/ProtonMail/go-crypto v1.1.0-alpha.4.0.20240718114024-3461b3a7504e github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.7.0 diff --git a/go.sum b/go.sum index a577db17..aa4cae5f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/ProtonMail/go-crypto v1.1.0-alpha.4 h1:u9M9ZUKM8SARn4u2IPVzHX4fg91EEeRpmeqO6lH08fc= -github.com/ProtonMail/go-crypto v1.1.0-alpha.4/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v1.1.0-alpha.4.0.20240718114024-3461b3a7504e h1:bSCY9HFgeSI8FYHCYOTtqLnoq0ADRYDrLvHcNm0O5+o= +github.com/ProtonMail/go-crypto v1.1.0-alpha.4.0.20240718114024-3461b3a7504e/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k= github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=