Rename Certificate to CryptoContainer
Makes more sense as it holds certs and keys. Can be other formats than PEM in the future.
This commit is contained in:
parent
e6f509a26c
commit
dee2956406
|
@ -57,8 +57,8 @@
|
|||
0EC1BBA620D712DE007C4C7B /* DNSResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC1BBA420D71190007C4C7B /* DNSResolver.swift */; };
|
||||
0EC1BBA820D7D803007C4C7B /* ConnectionStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC1BBA720D7D803007C4C7B /* ConnectionStrategy.swift */; };
|
||||
0EC1BBA920D7D803007C4C7B /* ConnectionStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC1BBA720D7D803007C4C7B /* ConnectionStrategy.swift */; };
|
||||
0ECE3528212EB7770040F253 /* Certificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECE3527212EB7770040F253 /* Certificate.swift */; };
|
||||
0ECE352A212EB88E0040F253 /* Certificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECE3527212EB7770040F253 /* Certificate.swift */; };
|
||||
0ECE3528212EB7770040F253 /* CryptoContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECE3527212EB7770040F253 /* CryptoContainer.swift */; };
|
||||
0ECE352A212EB88E0040F253 /* CryptoContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECE3527212EB7770040F253 /* CryptoContainer.swift */; };
|
||||
0EE7A79520F61EDC00B42E6A /* PacketMacros.h in Sources */ = {isa = PBXBuildFile; fileRef = 0EE7A79420F61EDC00B42E6A /* PacketMacros.h */; };
|
||||
0EE7A79620F61EDC00B42E6A /* PacketMacros.h in Sources */ = {isa = PBXBuildFile; fileRef = 0EE7A79420F61EDC00B42E6A /* PacketMacros.h */; };
|
||||
0EE7A79820F6296F00B42E6A /* PacketMacros.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EE7A79720F6296F00B42E6A /* PacketMacros.m */; };
|
||||
|
@ -206,7 +206,7 @@
|
|||
0EBBF2FF2085196000E36B40 /* NWTCPConnectionState+Description.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NWTCPConnectionState+Description.swift"; sourceTree = "<group>"; };
|
||||
0EC1BBA420D71190007C4C7B /* DNSResolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DNSResolver.swift; sourceTree = "<group>"; };
|
||||
0EC1BBA720D7D803007C4C7B /* ConnectionStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionStrategy.swift; sourceTree = "<group>"; };
|
||||
0ECE3527212EB7770040F253 /* Certificate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Certificate.swift; sourceTree = "<group>"; };
|
||||
0ECE3527212EB7770040F253 /* CryptoContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CryptoContainer.swift; sourceTree = "<group>"; };
|
||||
0EE7A79420F61EDC00B42E6A /* PacketMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PacketMacros.h; sourceTree = "<group>"; };
|
||||
0EE7A79720F6296F00B42E6A /* PacketMacros.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PacketMacros.m; sourceTree = "<group>"; };
|
||||
0EE7A79D20F6488400B42E6A /* DataPathEncryption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataPathEncryption.h; sourceTree = "<group>"; };
|
||||
|
@ -451,8 +451,8 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
0EBBF2E32084FDF400E36B40 /* Transport */,
|
||||
0ECE3527212EB7770040F253 /* Certificate.swift */,
|
||||
0EC1BBA720D7D803007C4C7B /* ConnectionStrategy.swift */,
|
||||
0ECE3527212EB7770040F253 /* CryptoContainer.swift */,
|
||||
0EC1BBA420D71190007C4C7B /* DNSResolver.swift */,
|
||||
0EBBF2E42084FE6F00E36B40 /* GenericSocket.swift */,
|
||||
0EFEB4AA200760EC00F81029 /* InterfaceObserver.swift */,
|
||||
|
@ -848,7 +848,7 @@
|
|||
0EFEB4AC200760EC00F81029 /* InterfaceObserver.swift in Sources */,
|
||||
0EFEB46D2006D3C800F81029 /* Data+Manipulation.swift in Sources */,
|
||||
0EFEB47B2006D3C800F81029 /* TunnelKitProvider.swift in Sources */,
|
||||
0ECE3528212EB7770040F253 /* Certificate.swift in Sources */,
|
||||
0ECE3528212EB7770040F253 /* CryptoContainer.swift in Sources */,
|
||||
0EFEB4742006D3C800F81029 /* CoreConfiguration.swift in Sources */,
|
||||
0E07595F20EF6D1400F38FD8 /* CryptoCBC.m in Sources */,
|
||||
0EC1BBA820D7D803007C4C7B /* ConnectionStrategy.swift in Sources */,
|
||||
|
@ -899,7 +899,7 @@
|
|||
0EFEB4A22006D7F300F81029 /* CoreConfiguration.swift in Sources */,
|
||||
0EFEB4952006D7F300F81029 /* SecureRandom.swift in Sources */,
|
||||
0EFEB49A2006D7F300F81029 /* MSS.m in Sources */,
|
||||
0ECE352A212EB88E0040F253 /* Certificate.swift in Sources */,
|
||||
0ECE352A212EB88E0040F253 /* CryptoContainer.swift in Sources */,
|
||||
0EFEB48D2006D7F300F81029 /* SessionProxy+EncryptionBridge.swift in Sources */,
|
||||
0EFEB4922006D7F300F81029 /* ZeroingData.m in Sources */,
|
||||
0E07596020EF6D1400F38FD8 /* CryptoCBC.m in Sources */,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Certificate.swift
|
||||
// CryptoContainer.swift
|
||||
// TunnelKit
|
||||
//
|
||||
// Created by Davide De Rosa on 8/22/18.
|
||||
|
@ -37,10 +37,10 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
/// Represents a TLS certificate in PEM format.
|
||||
public struct Certificate: Equatable {
|
||||
/// Represents a cryptographic container in PEM format.
|
||||
public struct CryptoContainer: Equatable {
|
||||
|
||||
/// The content of the certificates in PEM format (ASCII).
|
||||
/// The content in PEM format (ASCII).
|
||||
public let pem: String
|
||||
|
||||
/// :nodoc:
|
||||
|
@ -55,7 +55,7 @@ public struct Certificate: Equatable {
|
|||
// MARK: Equatable
|
||||
|
||||
/// :nodoc:
|
||||
public static func ==(lhs: Certificate, rhs: Certificate) -> Bool {
|
||||
public static func ==(lhs: CryptoContainer, rhs: CryptoContainer) -> Bool {
|
||||
return lhs.pem == rhs.pem
|
||||
}
|
||||
}
|
|
@ -152,13 +152,13 @@ extension TunnelKitProvider {
|
|||
public var digest: SessionProxy.Digest
|
||||
|
||||
/// The optional CA certificate to validate server against. Set to `nil` to disable CA validation (default).
|
||||
public var ca: Certificate?
|
||||
public var ca: CryptoContainer?
|
||||
|
||||
/// The optional client certificate to authenticate with. Set to `nil` to disable client authentication (default).
|
||||
public var clientCertificate: Certificate?
|
||||
public var clientCertificate: CryptoContainer?
|
||||
|
||||
/// The optional key for `clientCertificate`. Set to `nil` if client authentication unused (default).
|
||||
public var clientKey: Certificate?
|
||||
public var clientKey: CryptoContainer?
|
||||
|
||||
/// The MTU of the link.
|
||||
public var mtu: Int
|
||||
|
@ -217,11 +217,11 @@ extension TunnelKitProvider {
|
|||
throw ProviderError.configuration(field: "protocolConfiguration.providerConfiguration[\(S.digestAlgorithm)]")
|
||||
}
|
||||
|
||||
let ca: Certificate?
|
||||
let clientCertificate: Certificate?
|
||||
let clientKey: Certificate?
|
||||
let ca: CryptoContainer?
|
||||
let clientCertificate: CryptoContainer?
|
||||
let clientKey: CryptoContainer?
|
||||
if let pem = providerConfiguration[S.ca] as? String {
|
||||
ca = Certificate(pem: pem)
|
||||
ca = CryptoContainer(pem: pem)
|
||||
} else {
|
||||
ca = nil
|
||||
}
|
||||
|
@ -230,8 +230,8 @@ extension TunnelKitProvider {
|
|||
throw ProviderError.configuration(field: "protocolConfiguration.providerConfiguration[\(S.clientKey)]")
|
||||
}
|
||||
|
||||
clientCertificate = Certificate(pem: pem)
|
||||
clientKey = Certificate(pem: keyPEM)
|
||||
clientCertificate = CryptoContainer(pem: pem)
|
||||
clientKey = CryptoContainer(pem: keyPEM)
|
||||
} else {
|
||||
clientCertificate = nil
|
||||
clientKey = nil
|
||||
|
@ -363,13 +363,13 @@ extension TunnelKitProvider {
|
|||
public let digest: SessionProxy.Digest
|
||||
|
||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.ca`
|
||||
public let ca: Certificate?
|
||||
public let ca: CryptoContainer?
|
||||
|
||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.clientCertificate`
|
||||
public let clientCertificate: Certificate?
|
||||
public let clientCertificate: CryptoContainer?
|
||||
|
||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.clientKey`
|
||||
public let clientKey: Certificate?
|
||||
public let clientKey: CryptoContainer?
|
||||
|
||||
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu`
|
||||
public let mtu: Int
|
||||
|
|
|
@ -68,7 +68,7 @@ class AppExtensionTests: XCTestCase {
|
|||
|
||||
builder.cipher = .aes128cbc
|
||||
builder.digest = .sha256
|
||||
builder.ca = Certificate(pem: "abcdef")
|
||||
builder.ca = CryptoContainer(pem: "abcdef")
|
||||
cfg = builder.build()
|
||||
|
||||
let proto = try? cfg.generatedTunnelProtocol(withBundleIdentifier: identifier, endpoint: endpoint)
|
||||
|
|
Loading…
Reference in New Issue