SSL¶
An SSL session manages handshakes, encryption and decryption. It is not tied to any transport layer.
Public Functions¶
alpn_selected¶
Get the protocol identifier negotiated via ALPN. Returns None when the
session has been disposed or is in SSLAuthFail.
Returns¶
- (ALPNProtocolName | None val)
state¶
Returns the SSL session state.
Returns¶
read¶
Returns unencrypted bytes to be passed to the application. If expect is
non-zero, this returns None until at least expect bytes are available,
then returns everything it holds, which is at least expect. Returns
None when the session has been disposed or is in SSLAuthFail.
Parameters¶
- expect: USize val = 0
Returns¶
write¶
When application data is sent, add it to the SSL session. Does nothing if
the session has been disposed. Raises an error if the handshake is not
complete or if SSL_write does not encrypt the data.
Parameters¶
- data: ByteSeq
Returns¶
- None val ?
receive¶
When data is received, add it to the SSL session. Does nothing when the
session has been disposed or is in SSLAuthFail or SSLError.
Parameters¶
- data: ByteSeq
Returns¶
- None val
can_send¶
Returns true if there are encrypted bytes to be passed to the destination. Returns false if the session has been disposed.
Returns¶
- Bool val
send¶
Returns encrypted bytes to be passed to the destination. Raises an error if no data is available. A disposed session has no data.
Returns¶
dispose¶
Dispose of the session. state returns SSLDisposed afterwards, whatever
state the session was in before.
Returns¶
- None val