Table of Contents

Interface TlsContext

Namespace
Org.BouncyCastle.Tls
Assembly
BouncyCastle.Cryptography.dll

Base interface for a TLS context implementation.

public interface TlsContext

Properties

ClientSupportedVersions

ProtocolVersion[] ClientSupportedVersions { get; }

Property Value

ProtocolVersion[]

ClientVersion

ProtocolVersion ClientVersion { get; }

Property Value

ProtocolVersion

Crypto

TlsCrypto Crypto { get; }

Property Value

TlsCrypto

IsServer

Return true if this context is for a server, false otherwise.

bool IsServer { get; }

Property Value

bool

true for a server based context, false for a client based one.

NonceGenerator

TlsNonceGenerator NonceGenerator { get; }

Property Value

TlsNonceGenerator

ResumableSession

Used to get the resumable session, if any, used by this connection.

TlsSession ResumableSession { get; }

Property Value

TlsSession

A TlsSession representing the resumable session used by this connection, or null if no resumable session available.

Remarks

Only available after the handshake has successfully completed.

See Also

RsaPreMasterSecretVersion

ProtocolVersion RsaPreMasterSecretVersion { get; }

Property Value

ProtocolVersion

SecurityParameters

SecurityParameters SecurityParameters { get; }

Property Value

SecurityParameters

ServerVersion

ProtocolVersion ServerVersion { get; }

Property Value

ProtocolVersion

Session

Used to get the session information for this connection.

TlsSession Session { get; }

Property Value

TlsSession

A TlsSession representing the session used by this connection.

Remarks

Only available after the handshake has successfully completed. Use IsResumable to find out if the session is resumable.

See Also

UserObject

object UserObject { get; set; }

Property Value

object

Methods

ExportChannelBinding(int)

Export the value of the specified channel binding.

byte[] ExportChannelBinding(int channelBinding)

Parameters

channelBinding int

A ChannelBinding constant specifying the channel binding to export.

Returns

byte[]

A copy of the channel binding data as a byte[], or null if the binding could not be determined.

Remarks

Only available after the handshake has successfully completed.

ExportEarlyKeyingMaterial(string, byte[], int)

Export (early data) keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446).

byte[] ExportEarlyKeyingMaterial(string asciiLabel, byte[] context_value, int length)

Parameters

asciiLabel string

indicates which application will use the exported keys.

context_value byte[]

allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.

length int

the number of bytes to generate.

Returns

byte[]

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.

Remarks

NOTE: for use in settings where an exporter is needed for 0-RTT data.

ExportKeyingMaterial(string, byte[], int)

Export keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446) when negotiated.

byte[] ExportKeyingMaterial(string asciiLabel, byte[] context_value, int length)

Parameters

asciiLabel string

indicates which application will use the exported keys.

context_value byte[]

allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.

length int

the number of bytes to generate.

Returns

byte[]

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.