TlsSession
class TlsSession
This class represents a TLS session. It manages the context for the session, which is used for input as well as output streams.
-
The TLS context.
Declaration
Swift
let context: SSLContext
-
The session delegates.
Declaration
Swift
var delegates: [TlsSessionDelegate]
-
Indicates whether the TLS handshake was interrupted.
Declaration
Swift
private var interrupted: Bool
-
Initializes a TLS session for a given target and stream.
Note
Default App Transport Security (ATS) settings are used. The ATS settings cannot be configured in the app’s information property list (
Info.plist
).Declaration
Swift
init?(forTarget target: Target, withStream stream: PairedStream)
Parameters
target
The target for the TLS session.
stream
The TCP stream to the target.
-
Destroys a TLS session.
Declaration
Swift
deinit
-
The state of the TLS session.
Declaration
Swift
var state: SSLSessionState { get }
-
This function is called when there is space available for the handshake. When called it will initiate a TLS handshake or send additional data in order to complete the handshake (it is a two-way process).
Declaration
Swift
func spaceAvailableForHandshake()
-
This function is called when there are bytes available for the handshake.
Declaration
Swift
func bytesAvailableForHandshake()
-
Initiate a TLS handshake.
Declaration
Swift
private func shakeHands() -> OSStatus
Return Value
A status returned by the secure transport library.
-
Deceide how to handle the result while shaking hands. If there is no error, the streams will be opened. If the current handshake blocks, it needs to be continue, either by writing some more data, if space is available, or by waiting for a response of the target.
Declaration
Swift
private func handleHandshakeResult(status: OSStatus)
Parameters
status
The status from the secure transport library.