@@ -163,12 +163,12 @@ func (e *Entity) DecryptionKeys(id uint64, date time.Time) (keys []Key) {
163
163
for _ , subkey := range e .Subkeys {
164
164
subkeySelfSig , err := subkey .LatestValidBindingSignature (date )
165
165
if err == nil &&
166
- isValidEncryptionKey (subkeySelfSig , subkey .PublicKey .PubKeyAlgo ) &&
166
+ isValidDecryptionKey (subkeySelfSig , subkey .PublicKey .PubKeyAlgo ) &&
167
167
(id == 0 || subkey .PublicKey .KeyId == id ) {
168
168
keys = append (keys , Key {subkey .Primary , primarySelfSignature , subkey .PublicKey , subkey .PrivateKey , subkeySelfSig })
169
169
}
170
170
}
171
- if isValidEncryptionKey (primarySelfSignature , e .PrimaryKey .PubKeyAlgo ) {
171
+ if isValidDecryptionKey (primarySelfSignature , e .PrimaryKey .PubKeyAlgo ) {
172
172
keys = append (keys , Key {e , primarySelfSignature , e .PrimaryKey , e .PrivateKey , primarySelfSignature })
173
173
}
174
174
return
@@ -794,6 +794,12 @@ func isValidCertificationKey(signature *packet.Signature, algo packet.PublicKeyA
794
794
}
795
795
796
796
func isValidEncryptionKey (signature * packet.Signature , algo packet.PublicKeyAlgorithm ) bool {
797
+ return algo .CanEncrypt () &&
798
+ signature .FlagsValid &&
799
+ (signature .FlagEncryptCommunications || signature .FlagEncryptStorage )
800
+ }
801
+
802
+ func isValidDecryptionKey (signature * packet.Signature , algo packet.PublicKeyAlgorithm ) bool {
797
803
return algo .CanEncrypt () &&
798
804
signature .FlagsValid &&
799
805
(signature .FlagEncryptCommunications || signature .FlagForward || signature .FlagEncryptStorage )
0 commit comments