@@ -163,12 +163,12 @@ func (e *Entity) DecryptionKeys(id uint64, date time.Time, config *packet.Config
163
163
for _ , subkey := range e .Subkeys {
164
164
subkeySelfSig , err := subkey .LatestValidBindingSignature (date , config )
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
@@ -796,6 +796,12 @@ func isValidCertificationKey(signature *packet.Signature, algo packet.PublicKeyA
796
796
}
797
797
798
798
func isValidEncryptionKey (signature * packet.Signature , algo packet.PublicKeyAlgorithm ) bool {
799
+ return algo .CanEncrypt () &&
800
+ signature .FlagsValid &&
801
+ (signature .FlagEncryptCommunications || signature .FlagEncryptStorage )
802
+ }
803
+
804
+ func isValidDecryptionKey (signature * packet.Signature , algo packet.PublicKeyAlgorithm ) bool {
799
805
return algo .CanEncrypt () &&
800
806
signature .FlagsValid &&
801
807
(signature .FlagEncryptCommunications || signature .FlagForward || signature .FlagEncryptStorage )
0 commit comments