Throw specific error if unable to decrypt

Normally a bad passphrase.
This commit is contained in:
Davide De Rosa 2019-03-25 19:24:35 +01:00
parent ffcccb5420
commit 00c76f707f
1 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,9 @@ public class ConfigurationParser {
/// Passphrase required to decrypt private keys.
case encryptionPassphrase
/// Encryption passphrase is incorrect or key is corrupt.
case unableToDecrypt(error: Error)
}
/// Result of the parser.
@ -224,7 +227,7 @@ public class ConfigurationParser {
do {
clientKey = try container.decrypted(with: passphrase)
} catch let e {
unsupportedError = ParsingError.unsupportedConfiguration(option: e.localizedDescription)
unsupportedError = ParsingError.unableToDecrypt(error: e)
}
} else {
clientKey = container