decryption: always request key passphrase based on key ID
This commit is contained in:
parent
d136175d93
commit
2ae751044c
6 changed files with 85 additions and 130 deletions
|
|
@ -24,8 +24,13 @@ struct ObjectivePGPInterface: PGPInterface {
|
|||
}
|
||||
}
|
||||
|
||||
func decrypt(encryptedData: Data, keyID _: String?, passphrase: String) throws -> Data? {
|
||||
try ObjectivePGP.decrypt(encryptedData, andVerifySignature: false, using: keyring.keys) { _ in passphrase }
|
||||
func decrypt(encryptedData: Data, keyID _: String?, passPhraseForKey: @escaping (String) -> String) throws -> Data? {
|
||||
try ObjectivePGP.decrypt(encryptedData, andVerifySignature: false, using: keyring.keys) { selectedKey in
|
||||
guard let selectedKey else {
|
||||
return nil
|
||||
}
|
||||
return passPhraseForKey(selectedKey.keyID.longIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
func encrypt(plainData: Data, keyID _: String?) throws -> Data {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue