Fix decryption issue when key without passphrase set
This commit is contained in:
parent
776884e894
commit
011762c4bd
4 changed files with 153 additions and 2 deletions
|
|
@ -84,7 +84,14 @@ struct GopenPGPInterface: PGPInterface {
|
|||
}
|
||||
|
||||
do {
|
||||
let unlockedKey = try privateKey.unlock(passphrase.data(using: .utf8))
|
||||
var isLocked: ObjCBool = false
|
||||
try privateKey.isLocked(&isLocked)
|
||||
var unlockedKey: CryptoKey!
|
||||
if isLocked.boolValue {
|
||||
unlockedKey = try privateKey.unlock(passphrase.data(using: .utf8))
|
||||
} else {
|
||||
unlockedKey = privateKey
|
||||
}
|
||||
var error: NSError?
|
||||
|
||||
guard let keyRing = CryptoNewKeyRing(unlockedKey, &error) else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue