Structures

The following structures are available globally.

  • Wraps a single error from BoringSSL.

    See more

    Declaration

    Swift

    public struct BoringSSLInternalError : Equatable, CustomStringConvertible
  • Closing the TLS channel cleanly timed out, so it was closed uncleanly.

    Declaration

    Swift

    public struct NIOSSLCloseTimedOutError : Error
  • This structure contains errors added to NIOSSL after the original NIOSSLError enum was shipped. This is an extensible error object that allows us to evolve it going forward.

    See more

    Declaration

    Swift

    public struct NIOSSLExtraError : Error
    extension NIOSSLExtraError: CustomStringConvertible
    extension NIOSSLExtraError: Equatable
  • A container of a single PKCS#12 bundle.

    PKCS#12 is a specification that defines an archive format for storing multiple cryptographic objects together in one file. Its most common usage, and the one that SwiftNIO is most interested in, is its use to bundle one or more X.509 certificates (NIOSSLCertificate) together with an associated private key (NIOSSLPrivateKey).

    Working with TLSConfiguration

    In many cases users will want to configure a TLSConfiguration with the data from a PKCS#12 bundle. This object assists in unpacking that bundle into its associated pieces.

    If you have a PKCS12 bundle, you configure a TLSConfiguration like this:

    let p12Bundle = NIOSSLPKCS12Bundle(file: pathToMyP12)
    let config = TLSConfiguration.forServer(certificateChain: p12Bundle.certificateChain,
                                            privateKey: p12Bundle.privateKey)
    

    The created TLSConfiguration can then be safely used for your endpoint.

    See more

    Declaration

    Swift

    public struct NIOSSLPKCS12Bundle
  • Signature algorithms. The values are defined as in TLS 1.3

    See more

    Declaration

    Swift

    public struct SignatureAlgorithm : RawRepresentable, Hashable
  • Manages configuration of TLS for SwiftNIO programs.

    See more

    Declaration

    Swift

    public struct TLSConfiguration
  • A TLS provider to bootstrap TLS-enabled connections with NIOClientTCPBootstrap.

    Example:

    // TLS setup.
    let configuration = TLSConfiguration.forClient()
    let sslContext = try NIOSSLContext(configuration: configuration)
    
    // Creating the "universal bootstrap" with the `NIOSSLClientTLSProvider`.
    let tlsProvider = NIOSSLClientTLSProvider<ClientBootstrap>(context: sslContext, serverHostname: "example.com")
    let bootstrap = NIOClientTCPBootstrap(ClientBootstrap(group: group), tls: tlsProvider)
    
    // Bootstrapping a connection using the "universal bootstrapping mechanism"
    let connection = bootstrap.enableTLS()
                         .connect(to: "example.com")
                         .wait()
    
    See more

    Declaration

    Swift

    public struct NIOSSLClientTLSProvider<Bootstrap> : NIOClientTLSProvider where Bootstrap : NIOClientTCPBootstrapProtocol