Throw specific error if unable to decrypt
Normally a bad passphrase.
This commit is contained in:
parent
ffcccb5420
commit
00c76f707f
|
@ -43,6 +43,9 @@ public class ConfigurationParser {
|
||||||
|
|
||||||
/// Passphrase required to decrypt private keys.
|
/// Passphrase required to decrypt private keys.
|
||||||
case encryptionPassphrase
|
case encryptionPassphrase
|
||||||
|
|
||||||
|
/// Encryption passphrase is incorrect or key is corrupt.
|
||||||
|
case unableToDecrypt(error: Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Result of the parser.
|
/// Result of the parser.
|
||||||
|
@ -224,7 +227,7 @@ public class ConfigurationParser {
|
||||||
do {
|
do {
|
||||||
clientKey = try container.decrypted(with: passphrase)
|
clientKey = try container.decrypted(with: passphrase)
|
||||||
} catch let e {
|
} catch let e {
|
||||||
unsupportedError = ParsingError.unsupportedConfiguration(option: e.localizedDescription)
|
unsupportedError = ParsingError.unableToDecrypt(error: e)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clientKey = container
|
clientKey = container
|
||||||
|
|
Loading…
Reference in New Issue