Functions

The following functions are available globally.

  • Creates a TLS/SSL session for the provided streams.

    This currently works for server side only.

    The provided Certificates are used for encryption.

    When creating an encrypted stream pair, a handshake will automatically be performed. If the handshake fails, a TLSError will be thrown.

    Throws

    A TLSError indicating that the TLS/SSL session could not be created.

    Declaration

    Swift

    public func TLSCreateStreamPair(fromInputStream inputStream: InputStream, outputStream: OutputStream, certificates: [Certificate]) throws -> (inputStream: TLSInputStream, outputStream: TLSOutputStream)

    Parameters

    inputStream

    Input stream which should be used as an underlying stream to the TLS/SSL input stream. Reads the encrypted data.

    outputStream

    Output stream which should be used as an underlying stream to the TLS/SSL output stream. The encrypted data will be written to it.

    certificates

    Array of certificates for encryption. The first certificate has to contain a private key used for decryption. A private key will automatically be included if the certificate is loaded from a PKCS12-file.

    Return Value

    An encrypted input and output stream.

  • Compares the two certificates.

    If both certificates are equal, true is returned. If not, false is returned.

    The comparison is based on the private keys of

    Declaration

    Swift

    public func == (left: Certificate, right: Certificate) -> Bool

    Parameters

    left

    First certificate for comparison

    right

    Second certificate for comparison

    Return Value

    A boolean indicating if the two certificates are equal.