TLSConfiguration

public struct TLSConfiguration

Configuration for connecting with TLS. For more info, see https://github.com/Kitura-Next/BlueSSLService.

  • Initialize a configuration with no backing certificates.

    Declaration

    Swift

    public init(withCipherSuite cipherSuite: String? = nil,
                clientAllowsSelfSignedCertificates: Bool = false)

    Parameters

    cipherSuite

    Optional String containing the cipher suite to use.

    clientAllowsSelfSignedCertificates

    true to accept self-signed certificates from a server. false otherwise.

  • Initialize a configuration using a CA Certificate file.

    Declaration

    Swift

    public init(withCACertificateFilePath caCertificateFilePath: String?,
                usingCertificateFile certificateFilePath: String?,
                withKeyFile keyFilePath: String? = nil,
                usingSelfSignedCerts selfSigned: Bool = true,
                cipherSuite: String? = nil)

    Parameters

    caCertificateFilePath

    Path to the PEM formatted CA certificate file.

    certificateFilePath

    Path to the PEM formatted certificate file.

    keyFilePath

    Path to the PEM formatted key file. If nil, certificateFilePath will be used.

    selfSigned

    True if certs are self-signed, false otherwise. Defaults to true.

    cipherSuite

    Optional String containing the cipher suite to use.

  • Initialize a configuration using a CA Certificate directory.

    Note: caCertificateDirPath - All certificates in the specified directory must be hashed using the OpenSSL Certificate Tool.

    Declaration

    Swift

    public init(withCACertificateDirectory caCertificateDirPath: String?,
                usingCertificateFile certificateFilePath: String?,
                withKeyFile keyFilePath: String? = nil,
                usingSelfSignedCerts selfSigned: Bool = true,
                cipherSuite: String? = nil)

    Parameters

    caCertificateDirPath

    Path to a directory containing CA certificates. (see note above)

    certificateFilePath

    Path to the PEM formatted certificate file. If nil, certificateFilePath will be used.

    keyFilePath

    Path to the PEM formatted key file (optional). If nil, certificateFilePath is used.

    selfSigned

    True if certs are self-signed, false otherwise. Defaults to true.

    cipherSuite

    Optional String containing the cipher suite to use.

  • Initialize a configuration using a Certificate Chain File.

    Note: If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject’s certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.

    Declaration

    Swift

    public init(withChainFilePath chainFilePath: String?,
                withPassword password: String? = nil,
                usingSelfSignedCerts selfSigned: Bool = true,
                clientAllowsSelfSignedCertificates: Bool = false,
                cipherSuite: String? = nil)

    Parameters

    chainFilePath

    Path to the certificate chain file (optional). (see note above)

    password

    Password for the chain file (optional). If using self-signed certs, a password is required.

    selfSigned

    True if certs are self-signed, false otherwise. Defaults to true.

    clientAllowsSelfSignedCertificates

    True if, as a client, connections to self-signed servers are allowed

    cipherSuite

    Optional String containing the cipher suite to use.

  • Initialize a configuration using a PEM formatted certificate in String form.