public struct SSLConfig

A struct that allows you to configure your SSL using a CA certificate file (Linux), a CA certificate directory (Linux) or a certificate chain file (MacOS).

  • Initialize an SSLService.Configuration instance 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.

    For testing purposes you will most likely want to create and use some self-signed certificates. Follow the instructions in our Enabling SSL/TLS On Your Kitura Server tutorial.

    Usage Example:

    This example initializes an SSLConfig instance and then associates this SSL configuration with the Kitura HTTP server registration.

    let mySSLConfig =  SSLConfig(withChainFilePath: "/tmp/Creds/Self-Signed/cert.pfx",
                                 withPassword: "password",
                                 usingSelfSignedCerts: true)
    Kitura.addHTTPServer(onPort: 8080, with: router, withSSL: mySSLConfig)



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



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


    Export password for the chain file (optional). This is required if using a certificate chain file.


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



    Return Value

    New SSLConfig instance.