diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf1b14..ddd13ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Scramble endpoints via `--remote-random`. [#76](https://github.com/keeshux/tunnelkit/issues/76) +- Support for encrypted certificate private keys. [#72](https://github.com/keeshux/tunnelkit/issues/72) ### Fixed diff --git a/README.md b/README.md index edb9559..bcab6d9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,6 @@ Unsupported: - Compression via `--compress` other than empty or `lzo` - Proxy - External file references (inline `` only) -- Encrypted client certificate keys - `` blocks Ignored: diff --git a/TunnelKit.xcodeproj/project.pbxproj b/TunnelKit.xcodeproj/project.pbxproj index 787406b..f72999a 100644 --- a/TunnelKit.xcodeproj/project.pbxproj +++ b/TunnelKit.xcodeproj/project.pbxproj @@ -61,8 +61,14 @@ 0E3B15C82152B05E00984B17 /* CryptoCTR.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E3B15C52152B05E00984B17 /* CryptoCTR.h */; }; 0E3B15C92152B05E00984B17 /* CryptoCTR.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E3B15C62152B05E00984B17 /* CryptoCTR.m */; }; 0E3B15CA2152B05E00984B17 /* CryptoCTR.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E3B15C62152B05E00984B17 /* CryptoCTR.m */; }; + 0E3B65742249253A00EFF4DA /* tunnelbear.enc.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = 0E3B656E224923EC00EFF4DA /* tunnelbear.enc.ovpn */; }; + 0E3B65752249253B00EFF4DA /* tunnelbear.enc.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = 0E3B656E224923EC00EFF4DA /* tunnelbear.enc.ovpn */; }; + 0E3B65762249253F00EFF4DA /* tunnelbear.key in Resources */ = {isa = PBXBuildFile; fileRef = 0E3B65712249247E00EFF4DA /* tunnelbear.key */; }; + 0E3B65772249254000EFF4DA /* tunnelbear.key in Resources */ = {isa = PBXBuildFile; fileRef = 0E3B65712249247E00EFF4DA /* tunnelbear.key */; }; 0E3E0F212108A8CC00B371C1 /* SessionProxy+PushReply.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3E0F202108A8CC00B371C1 /* SessionProxy+PushReply.swift */; }; 0E3E0F222108A8CC00B371C1 /* SessionProxy+PushReply.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3E0F202108A8CC00B371C1 /* SessionProxy+PushReply.swift */; }; + 0E500EA622493B5B00CAE560 /* tunnelbear.enc.key in Resources */ = {isa = PBXBuildFile; fileRef = 0E500EA522493B5B00CAE560 /* tunnelbear.enc.key */; }; + 0E500EA722493B5B00CAE560 /* tunnelbear.enc.key in Resources */ = {isa = PBXBuildFile; fileRef = 0E500EA522493B5B00CAE560 /* tunnelbear.enc.key */; }; 0E50D57521634E0A00FC87A8 /* ControlChannelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E50D57421634E0A00FC87A8 /* ControlChannelTests.swift */; }; 0E58BF3322405410006FB157 /* lzoconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF2F22405410006FB157 /* lzoconf.h */; }; 0E58BF3422405410006FB157 /* lzoconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF2F22405410006FB157 /* lzoconf.h */; }; @@ -76,14 +82,14 @@ 0E58BF3D2240547F006FB157 /* CompressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF3B2240547F006FB157 /* CompressionTests.swift */; }; 0E58BF4C22405C2F006FB157 /* StandardLZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF4922405C2F006FB157 /* StandardLZO.m */; }; 0E58BF4D22405C2F006FB157 /* StandardLZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF4922405C2F006FB157 /* StandardLZO.m */; }; - 0E58BF5622411F3D006FB157 /* LZO.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF5522411F37006FB157 /* LZO.h */; }; - 0E58BF5722411F3E006FB157 /* LZO.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF5522411F37006FB157 /* LZO.h */; }; - 0E58BF5922411FEF006FB157 /* LZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF5822411FEF006FB157 /* LZO.m */; }; - 0E58BF5A22411FEF006FB157 /* LZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF5822411FEF006FB157 /* LZO.m */; }; 0E58BF502240F98F006FB157 /* CompressionAlgorithmNative.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF4F2240F98E006FB157 /* CompressionAlgorithmNative.h */; }; 0E58BF512240F98F006FB157 /* CompressionAlgorithmNative.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF4F2240F98E006FB157 /* CompressionAlgorithmNative.h */; }; 0E58BF532240FAA6006FB157 /* SessionProxy+CompressionAlgorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF522240FAA6006FB157 /* SessionProxy+CompressionAlgorithm.swift */; }; 0E58BF542240FAA6006FB157 /* SessionProxy+CompressionAlgorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF522240FAA6006FB157 /* SessionProxy+CompressionAlgorithm.swift */; }; + 0E58BF5622411F3D006FB157 /* LZO.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF5522411F37006FB157 /* LZO.h */; }; + 0E58BF5722411F3E006FB157 /* LZO.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E58BF5522411F37006FB157 /* LZO.h */; }; + 0E58BF5922411FEF006FB157 /* LZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF5822411FEF006FB157 /* LZO.m */; }; + 0E58BF5A22411FEF006FB157 /* LZO.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BF5822411FEF006FB157 /* LZO.m */; }; 0E58F1302138AC2F00A49F27 /* DNSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E58F12F2138AC2F00A49F27 /* DNSTests.swift */; }; 0E749F5F2178885500BB2701 /* SessionProxy+PIA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E749F5E2178885500BB2701 /* SessionProxy+PIA.swift */; }; 0E749F602178885500BB2701 /* SessionProxy+PIA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E749F5E2178885500BB2701 /* SessionProxy+PIA.swift */; }; @@ -290,7 +296,10 @@ 0E39BCE7214B2AB60035E9DE /* ControlPacket.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ControlPacket.m; sourceTree = ""; }; 0E3B15C52152B05E00984B17 /* CryptoCTR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoCTR.h; sourceTree = ""; }; 0E3B15C62152B05E00984B17 /* CryptoCTR.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CryptoCTR.m; sourceTree = ""; }; + 0E3B656E224923EC00EFF4DA /* tunnelbear.enc.ovpn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tunnelbear.enc.ovpn; sourceTree = ""; }; + 0E3B65712249247E00EFF4DA /* tunnelbear.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tunnelbear.key; sourceTree = ""; }; 0E3E0F202108A8CC00B371C1 /* SessionProxy+PushReply.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionProxy+PushReply.swift"; sourceTree = ""; }; + 0E500EA522493B5B00CAE560 /* tunnelbear.enc.key */ = {isa = PBXFileReference; lastKnownFileType = text; path = tunnelbear.enc.key; sourceTree = ""; }; 0E50D57421634E0A00FC87A8 /* ControlChannelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlChannelTests.swift; sourceTree = ""; }; 0E58BF2F22405410006FB157 /* lzoconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzoconf.h; sourceTree = ""; }; 0E58BF3022405410006FB157 /* lzodefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzodefs.h; sourceTree = ""; }; @@ -298,10 +307,10 @@ 0E58BF3222405410006FB157 /* minilzo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = minilzo.c; sourceTree = ""; }; 0E58BF3B2240547F006FB157 /* CompressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompressionTests.swift; sourceTree = ""; }; 0E58BF4922405C2F006FB157 /* StandardLZO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StandardLZO.m; sourceTree = ""; }; - 0E58BF5522411F37006FB157 /* LZO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LZO.h; sourceTree = ""; }; - 0E58BF5822411FEF006FB157 /* LZO.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LZO.m; sourceTree = ""; }; 0E58BF4F2240F98E006FB157 /* CompressionAlgorithmNative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressionAlgorithmNative.h; sourceTree = ""; }; 0E58BF522240FAA6006FB157 /* SessionProxy+CompressionAlgorithm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionProxy+CompressionAlgorithm.swift"; sourceTree = ""; }; + 0E58BF5522411F37006FB157 /* LZO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LZO.h; sourceTree = ""; }; + 0E58BF5822411FEF006FB157 /* LZO.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LZO.m; sourceTree = ""; }; 0E58F12F2138AC2F00A49F27 /* DNSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DNSTests.swift; sourceTree = ""; }; 0E6479DD212EAC96008E6888 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0E6479E0212EACD6008E6888 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -454,6 +463,9 @@ 0EB2B45A20F0BE4C004233D7 /* TestUtils.swift */, 0E749F612178911C00BB2701 /* pia-2048.pem */, 0E011F832196E25400BA59EE /* pia-hungary.ovpn */, + 0E3B656E224923EC00EFF4DA /* tunnelbear.enc.ovpn */, + 0E500EA522493B5B00CAE560 /* tunnelbear.enc.key */, + 0E3B65712249247E00EFF4DA /* tunnelbear.key */, ); path = TunnelKitTests; sourceTree = ""; @@ -928,6 +940,9 @@ buildActionMask = 2147483647; files = ( 0E011F852196E25900BA59EE /* pia-hungary.ovpn in Resources */, + 0E500EA622493B5B00CAE560 /* tunnelbear.enc.key in Resources */, + 0E3B65762249253F00EFF4DA /* tunnelbear.key in Resources */, + 0E3B65742249253A00EFF4DA /* tunnelbear.enc.ovpn in Resources */, 0E749F622178911D00BB2701 /* pia-2048.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -961,6 +976,9 @@ buildActionMask = 2147483647; files = ( 0E011F862196E25A00BA59EE /* pia-hungary.ovpn in Resources */, + 0E500EA722493B5B00CAE560 /* tunnelbear.enc.key in Resources */, + 0E3B65772249254000EFF4DA /* tunnelbear.key in Resources */, + 0E3B65752249253B00EFF4DA /* tunnelbear.enc.ovpn in Resources */, 0EA82A3E2190B2BC007960EB /* pia-2048.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/TunnelKit/Sources/Core/ConfigurationParser.swift b/TunnelKit/Sources/Core/ConfigurationParser.swift index 60e2c46..7af7ca0 100644 --- a/TunnelKit/Sources/Core/ConfigurationParser.swift +++ b/TunnelKit/Sources/Core/ConfigurationParser.swift @@ -40,6 +40,12 @@ public class ConfigurationParser { /// The file includes an unsupported option. case unsupportedConfiguration(option: String) + + /// Passphrase required to decrypt private keys. + case encryptionPassphrase + + /// Encryption passphrase is incorrect or key is corrupt. + case unableToDecrypt(error: Error) } /// Result of the parser. @@ -114,25 +120,27 @@ public class ConfigurationParser { Parses an .ovpn file from an URL. - Parameter url: The URL of the configuration file. + - Parameter passphrase: The optional passphrase for encrypted data. - Parameter returnsStripped: When `true`, stores the stripped file into `ParsingResult.strippedLines`. Defaults to `false`. - Returns: The `ParsingResult` outcome of the parsing. - Throws: `ParsingError` if the configuration file is wrong or incomplete. */ - public static func parsed(fromURL url: URL, returnsStripped: Bool = false) throws -> ParsingResult { + public static func parsed(fromURL url: URL, passphrase: String? = nil, returnsStripped: Bool = false) throws -> ParsingResult { let lines = try String(contentsOf: url).trimmedLines() - return try parsed(fromLines: lines, originalURL: url, returnsStripped: returnsStripped) + return try parsed(fromLines: lines, passphrase: passphrase, originalURL: url, returnsStripped: returnsStripped) } /** Parses an .ovpn file as an array of lines. - Parameter lines: The array of lines holding the configuration. + - Parameter passphrase: The optional passphrase for encrypted data. - Parameter originalURL: The optional original URL of the configuration file. - Parameter returnsStripped: When `true`, stores the stripped file into `ParsingResult.strippedLines`. Defaults to `false`. - Returns: The `ParsingResult` outcome of the parsing. - Throws: `ParsingError` if the configuration file is wrong or incomplete. */ - public static func parsed(fromLines lines: [String], originalURL: URL? = nil, returnsStripped: Bool = false) throws -> ParsingResult { + public static func parsed(fromLines lines: [String], passphrase: String? = nil, originalURL: URL? = nil, returnsStripped: Bool = false) throws -> ParsingResult { var strippedLines: [String]? = returnsStripped ? [] : nil var warning: ParsingError? = nil @@ -209,10 +217,20 @@ public class ConfigurationParser { clientCertificate = CryptoContainer(pem: currentBlock.joined(separator: "\n")) case "key": + let isEncrypted = normalizeEncryptedPEMBlock(block: ¤tBlock) let container = CryptoContainer(pem: currentBlock.joined(separator: "\n")) - clientKey = container - if container.isEncrypted { - unsupportedError = ParsingError.unsupportedConfiguration(option: "encrypted client certificate key") + if isEncrypted { + guard let passphrase = passphrase else { + unsupportedError = ParsingError.encryptionPassphrase + break + } + do { + clientKey = try container.decrypted(with: passphrase) + } catch let e { + unsupportedError = ParsingError.unableToDecrypt(error: e) + } + } else { + clientKey = container } case "tls-auth": @@ -451,6 +469,16 @@ public class ConfigurationParser { warning: warning ) } + + private static func normalizeEncryptedPEMBlock(block: inout [String]) -> Bool { + + // XXX: restore blank line after encryption header (easier than tweaking trimmedLines) + if block.count >= 3 && block[1].contains("ENCRYPTED") { + block.insert("", at: 3) + return true + } + return false + } } private extension SocketType { @@ -472,9 +500,3 @@ extension String { } } } - -extension CryptoContainer { - var isEncrypted: Bool { - return pem.contains("ENCRYPTED") - } -} diff --git a/TunnelKit/Sources/Core/CryptoContainer.swift b/TunnelKit/Sources/Core/CryptoContainer.swift index c56ea6c..d556d34 100644 --- a/TunnelKit/Sources/Core/CryptoContainer.swift +++ b/TunnelKit/Sources/Core/CryptoContainer.swift @@ -36,6 +36,7 @@ // import Foundation +import __TunnelKitNative /// Represents a cryptographic container in PEM format. public struct CryptoContainer: Equatable { @@ -73,3 +74,10 @@ extension CryptoContainer: Codable { try container.encode(pem) } } + +extension CryptoContainer { + func decrypted(with passphrase: String) throws -> CryptoContainer { + let decryptedPEM = try TLSBox.decryptedPrivateKey(fromPEM: pem, passphrase: passphrase) + return CryptoContainer(pem: decryptedPEM) + } +} diff --git a/TunnelKit/Sources/Core/TLSBox.h b/TunnelKit/Sources/Core/TLSBox.h index d47e50d..d162e11 100644 --- a/TunnelKit/Sources/Core/TLSBox.h +++ b/TunnelKit/Sources/Core/TLSBox.h @@ -52,6 +52,8 @@ extern NSString *const TLSBoxPeerVerificationErrorNotification; @interface TLSBox : NSObject + (nullable NSString *)md5ForCertificatePath:(NSString *)path error:(NSError **)error; ++ (nullable NSString *)decryptedPrivateKeyFromPath:(NSString *)path passphrase:(NSString *)passphrase error:(NSError **)error; ++ (nullable NSString *)decryptedPrivateKeyFromPEM:(NSString *)pem passphrase:(NSString *)passphrase error:(NSError **)error; - (instancetype)initWithCAPath:(NSString *)caPath clientCertificatePath:(nullable NSString *)clientCertificatePath diff --git a/TunnelKit/Sources/Core/TLSBox.m b/TunnelKit/Sources/Core/TLSBox.m index 274b9d9..9b62356 100644 --- a/TunnelKit/Sources/Core/TLSBox.m +++ b/TunnelKit/Sources/Core/TLSBox.m @@ -39,6 +39,8 @@ #import #import #import +#import +#import #import "TLSBox.h" #import "Allocation.h" @@ -107,6 +109,61 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { return hex; } ++ (NSString *)decryptedPrivateKeyFromPath:(NSString *)path passphrase:(NSString *)passphrase error:(NSError * _Nullable __autoreleasing *)error +{ + BIO *bio; + if (!(bio = BIO_new_file([path cStringUsingEncoding:NSASCIIStringEncoding], "r"))) { + return NULL; + } + NSString *ret = [[self class] decryptedPrivateKeyFromBIO:bio passphrase:passphrase error:error]; + BIO_free(bio); + return ret; +} + ++ (NSString *)decryptedPrivateKeyFromPEM:(NSString *)pem passphrase:(NSString *)passphrase error:(NSError * _Nullable __autoreleasing *)error +{ + BIO *bio; + if (!(bio = BIO_new_mem_buf([pem cStringUsingEncoding:NSASCIIStringEncoding], (int)[pem length]))) { + return NULL; + } + NSString *ret = [[self class] decryptedPrivateKeyFromBIO:bio passphrase:passphrase error:error]; + BIO_free(bio); + return ret; +} + ++ (NSString *)decryptedPrivateKeyFromBIO:(BIO *)bio passphrase:(NSString *)passphrase error:(NSError * _Nullable __autoreleasing *)error +{ + RSA *rsaKey; + if (!(rsaKey = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, (void *)passphrase.UTF8String))) { + return NULL; + } + + EVP_PKEY *evpKey = EVP_PKEY_new(); + if (!EVP_PKEY_set1_RSA(evpKey, rsaKey)) { + EVP_PKEY_free(evpKey); + return NULL; + } + BIO *output = BIO_new(BIO_s_mem()); + if (!PEM_write_bio_PKCS8PrivateKey(output, evpKey, NULL, NULL, 0, NULL, NULL)) { + BIO_free(output); + EVP_PKEY_free(evpKey); + return NULL; + } + + const int decLength = (int)BIO_ctrl_pending(output); + char *decKeyBytes = malloc(decLength + 1); + if (BIO_read(output, decKeyBytes, decLength) < 0) { + BIO_free(output); + EVP_PKEY_free(evpKey); + return NULL; + } + BIO_free(output); + EVP_PKEY_free(evpKey); + + decKeyBytes[decLength] = '\0'; + return [NSString stringWithCString:decKeyBytes encoding:NSASCIIStringEncoding]; +} + - (instancetype)init { [NSException raise:NSInvalidArgumentException format:@"Use initWithCAPath:clientCertificatePath:clientKeyPath:"]; diff --git a/TunnelKitTests/ConfigurationParserTests.swift b/TunnelKitTests/ConfigurationParserTests.swift index 61bb49d..fec82bb 100644 --- a/TunnelKitTests/ConfigurationParserTests.swift +++ b/TunnelKitTests/ConfigurationParserTests.swift @@ -80,6 +80,12 @@ class ConfigurationParserTests: XCTestCase { XCTAssertThrowsError(try ConfigurationParser.parsed(fromLines: lines)) } + func testEncryptedCertificateKey() throws { + let url = Bundle(for: ConfigurationParserTests.self).url(forResource: "tunnelbear", withExtension: "enc.ovpn")! + XCTAssertThrowsError(try ConfigurationParser.parsed(fromURL: url)) + XCTAssertNoThrow(try ConfigurationParser.parsed(fromURL: url, passphrase: "foobar")) + } + private func url(withName name: String) -> URL { return Bundle(for: ConfigurationParserTests.self).url(forResource: name, withExtension: "ovpn")! } diff --git a/TunnelKitTests/EncryptionTests.swift b/TunnelKitTests/EncryptionTests.swift index 606e98b..3e2677f 100644 --- a/TunnelKitTests/EncryptionTests.swift +++ b/TunnelKitTests/EncryptionTests.swift @@ -95,6 +95,23 @@ class EncryptionTests: XCTestCase { print(md5) XCTAssertEqual(md5, exp) } + + func testPrivateKeyDecryption() { + let bundle = Bundle(for: EncryptionTests.self) + let encryptedPath = bundle.path(forResource: "tunnelbear", ofType: "enc.key")! + let decryptedPath = bundle.path(forResource: "tunnelbear", ofType: "key")! + + XCTAssertThrowsError(try TLSBox.decryptedPrivateKey(fromPath: encryptedPath, passphrase: "wrongone")) + let decryptedViaPath = try! TLSBox.decryptedPrivateKey(fromPath: encryptedPath, passphrase: "foobar") + print(decryptedViaPath) + let encryptedPEM = try! String(contentsOfFile: encryptedPath, encoding: .utf8) + let decryptedViaString = try! TLSBox.decryptedPrivateKey(fromPEM: encryptedPEM, passphrase: "foobar") + print(decryptedViaString) + XCTAssertEqual(decryptedViaPath, decryptedViaString) + + let expDecrypted = try! String(contentsOfFile: decryptedPath) + XCTAssertEqual(decryptedViaPath, expDecrypted) + } func testCTR() { let (client, server) = clientServer("aes-256-ctr", "sha256") diff --git a/TunnelKitTests/tunnelbear.enc.key b/TunnelKitTests/tunnelbear.enc.key new file mode 100644 index 0000000..1e82c4d --- /dev/null +++ b/TunnelKitTests/tunnelbear.enc.key @@ -0,0 +1,54 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,1C7216F89C74E56260FE71A9C1BAB35E + +md+NHvPFW2KQTjzOdstXWEOKcjAp2Z+5sUtXlaeY+kymFOLyweefk1QX0UN1m4Dt +MSH0Zc5LEtwV2nd9rT2shxjZUsup1kpn8JPkXS0O/plEze3r0IrVegOi+tXc5eNA +2Rc4jD5UZqQTXF7B2sR7HNu/TlIrcnR5DuaqmIbn0FO/9SnpEdSSabHUZHXo6M0n +uikRHRFRXJjGR7Bi8PtueTgvOrqIt6W1e6ORZM/rs+VPGLGc6fCtGA0/aDhkpr4d +mKOeL+WZsIX/8TVlCFlBvqeDJac5ByqY58BmbCmqYjQnmCIvNsE23I9a2ufwNq8F +qimBAYnB/iyivY6Vhl5WMT3EehhgCaTcAjwp4xNaOAbmF0SInxM1WkBaeSM5gyE+ +GmiMef6JJU5tF1g64hzIllsDFR8VXPp8M+iRNjDBgbndOmKoTPzZfkJaqaMjTOtB +2EXqIciBsNZydVKkMAcwDJT5pFvKS7Sv2/mfBJbp3XdwrQl5UQwz7ZfyOnsjpLLB +5KZY8eCGrcFNFM6mPygKwhLo2/5Bh0Ke03lKd/edQuFp8wTDovyevgq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7d59RNTlXGdl6EC+Fx +l5nu6RrQlwJweJ7qL/SSp9BrKKQJACvai7HV2mwFG9alBBz/KRkeso4xsW3IjSUd +3+bC2y4l/U5Aku/i7WTRXMs8gqgqlok5wJnfwxzKRBXZt6nWGaIjGdfRrwNkQp2s +hDRbjIR3IqeQEhvwYQUP5Su9XYg+MVbxI9eHp70t7azM14+h97Lje8eEdtthtAHJ +NXWqzsNdpm3RkCRYzL/1Zy/d3OFGxuyor0Z46z4YlZ7paINxnmjj+XRx2hEKB0Ez +PhUE3IHV2sGFvTnRGDzDdXUk38BxQXbQU/ggvnU4Ki79ahNrgTHvdLZ2QZmFygoo +bLWELCnj4LXnorsIefqtzCuO4egJwCydE+AXV3Dmk/XXW8K4LRg2SB98/EJp6N71 +OMuRVuu8ZunbIIWmZ1iWSAkPzpffDmEjxwDmVQjxw/Bt8WzA33MuqRVvm1m+kL3u +-----END RSA PRIVATE KEY----- diff --git a/TunnelKitTests/tunnelbear.enc.ovpn b/TunnelKitTests/tunnelbear.enc.ovpn new file mode 100644 index 0000000..c64ec13 --- /dev/null +++ b/TunnelKitTests/tunnelbear.enc.ovpn @@ -0,0 +1,158 @@ +client +dev tun0 +proto udp +comp-lzo +nobind +ns-cert-type server +persist-key +persist-tun +reneg-sec 0 +dhcp-option DNS 8.8.8.8 +dhcp-option DNS 8.8.4.4 +redirect-gateway +verb 1 +auth-user-pass + +-----BEGIN CERTIFICATE----- +MIIG6zCCBNOgAwIBAgIJAJhm2PWFkE8NMA0GCSqGSIb3DQEBCwUAMIGpMQswCQYD +VQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxEzAR +BgNVBAoTCkdvb2dsZSBJbmMxEzARBgNVBAsTCkRldmVsb3BlcnMxFjAUBgNVBAMT +DUdvb2dsZSBJbmMgQ0ExEDAOBgNVBCkTB0Vhc3lSU0ExITAfBgkqhkiG9w0BCQEW +EnN1cHBvcnRAZ29vZ2xlLmNvbTAeFw0x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Q2TxkRVaV7d59RNTlXGdl6EC+Fx +l5nu6RrQlwJweJ7qL/SSp9BrKKQJACvai7HV2mwFG9alBBz/KRkeso4xsW3IjSUd +3+bC2y4l/U5Aku/i7WTRXMs8gqgqlok5wJnfwxzKRBXZt6nWGaIjGdfRrwNkQp2s +hDRbjIR3IqeQEhvwYQUP5Su9XYg+MVbxI9eHp70t7azM14+h97Lje8eEdtthtAHJ +NXWqzsNdpm3RkCRYzL/1Zy/d3OFGxuyor0Z46z4YlZ7paINxnmjj+XRx2hEKB0Ez +PhUE3IHV2sGFvTnRGDzDdXUk38BxQXbQU/ggvnU4Ki79ahNrgTHvdLZ2QZmFygoo +bLWELCnj4LXnorsIefqtzCuO4egJwCydE+AXV3Dmk/XXW8K4LRg2SB98/EJp6N71 +OMuRVuu8ZunbIIWmZ1iWSAkPzpffDmEjxwDmVQjxw/Bt8WzA33MuqRVvm1m+kL3u +-----END RSA PRIVATE KEY----- + +remote no.lazerpenguin.com 443 +cipher AES-256-CBC +auth SHA256 +keysize 256 diff --git a/TunnelKitTests/tunnelbear.key b/TunnelKitTests/tunnelbear.key new file mode 100644 index 0000000..6472551 --- /dev/null +++ b/TunnelKitTests/tunnelbear.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDvgpUJoqgvHmbF +2y7Uvt1BfglAXWmzzhaSjr4ZqYLMQncpcwC1iuVgDseGp/rl4C/C64RebIx0hLU1 +4kc4envr6s59tvLemSiSAOYwwmeOAkwk2SncbtV/sEiTSBDs87uTlc1TOYED1jns +ATqvNTTGyx8Vlx1Qd4MmxOSlPOfVwSybrIfLwgSuTaN1TjJZiKlG8FQn1/JId9tj +eDyHvHb7BsgBY6p9OctGw/NyLlwGNB7Yo1MKrolhHmTvHZbiLTaqWJHjKTBmlNtP +P+z+v27U/RF7bh1enzBHnjv0lyKxPRBpq1rInl4PkxIpV7hjHIRw35EcOsXl0xQ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