decryption: always request key passphrase based on key ID
This commit is contained in:
parent
c4f81c16eb
commit
01739e5aec
4 changed files with 23 additions and 17 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