From ffcccb542043adc1cf661dcfad8d17db7a8efab1 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 25 Mar 2019 18:30:52 +0100 Subject: [PATCH] Throw specific error on missing passphrase So that client can retry with a passphrase. --- TunnelKit/Sources/Core/ConfigurationParser.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TunnelKit/Sources/Core/ConfigurationParser.swift b/TunnelKit/Sources/Core/ConfigurationParser.swift index 01640bb..27f4fca 100644 --- a/TunnelKit/Sources/Core/ConfigurationParser.swift +++ b/TunnelKit/Sources/Core/ConfigurationParser.swift @@ -40,6 +40,9 @@ public class ConfigurationParser { /// The file includes an unsupported option. case unsupportedConfiguration(option: String) + + /// Passphrase required to decrypt private keys. + case encryptionPassphrase } /// Result of the parser. @@ -215,7 +218,7 @@ public class ConfigurationParser { let container = CryptoContainer(pem: currentBlock.joined(separator: "\n")) if isEncrypted { guard let passphrase = passphrase else { - unsupportedError = ParsingError.unsupportedConfiguration(option: "encrypted client certificate key (missing passphrase)") + unsupportedError = ParsingError.encryptionPassphrase break } do {