Class AbstractTlsClient
- Namespace
- Org.BouncyCastle.Tls
- Assembly
- BouncyCastle.Cryptography.dll
Base class for a TLS client.
public abstract class AbstractTlsClient : AbstractTlsPeer, TlsClient, TlsPeer
- Inheritance
-
AbstractTlsClient
- Implements
- Derived
- Inherited Members
Constructors
AbstractTlsClient(TlsCrypto)
protected AbstractTlsClient(TlsCrypto crypto)
Parameters
cryptoTlsCrypto
Fields
m_cipherSuites
protected int[] m_cipherSuites
Field Value
- int[]
m_context
protected TlsClientContext m_context
Field Value
m_protocolVersions
protected ProtocolVersion[] m_protocolVersions
Field Value
m_supportedGroups
protected IList<int> m_supportedGroups
Field Value
m_supportedSignatureAlgorithms
protected IList<SignatureAndHashAlgorithm> m_supportedSignatureAlgorithms
Field Value
m_supportedSignatureAlgorithmsCert
protected IList<SignatureAndHashAlgorithm> m_supportedSignatureAlgorithmsCert
Field Value
Methods
AllowUnexpectedServerExtension(int, byte[])
protected virtual bool AllowUnexpectedServerExtension(int extensionType, byte[] extensionData)
Parameters
Returns
Exceptions
CheckForUnexpectedServerExtension(IDictionary<int, byte[]>, int)
protected virtual void CheckForUnexpectedServerExtension(IDictionary<int, byte[]> serverExtensions, int extensionType)
Parameters
serverExtensionsIDictionary<int, byte[]>extensionTypeint
Exceptions
GetAllowedClientCertificateTypes()
protected virtual short[] GetAllowedClientCertificateTypes()
Returns
- short[]
GetAllowedServerCertificateTypes()
protected virtual short[] GetAllowedServerCertificateTypes()
Returns
- short[]
GetAuthentication()
public abstract TlsAuthentication GetAuthentication()
Returns
Exceptions
GetCertificateAuthorities()
protected virtual IList<X509Name> GetCertificateAuthorities()
Returns
GetCertificateStatusRequest()
protected virtual CertificateStatusRequest GetCertificateStatusRequest()
Returns
GetCipherSuites()
public override int[] GetCipherSuites()
Returns
- int[]
GetClientExtensions()
public virtual IDictionary<int, byte[]> GetClientExtensions()
Returns
- IDictionary<int, byte[]>
Exceptions
GetClientSupplementalData()
public virtual IList<SupplementalDataEntry> GetClientSupplementalData()
Returns
Exceptions
GetDHGroupVerifier()
public virtual TlsDHGroupVerifier GetDHGroupVerifier()
Returns
Exceptions
GetEarlyKeyShareGroups()
If this client is offering TLS 1.3 or higher, this method may be called to determine for which groups a key share should be included in the initial ClientHello.
public virtual IList<int> GetEarlyKeyShareGroups()
Returns
- IList<int>
an IList<T> of named group values, possibly empty or null.
Remarks
Groups that were not included in the supported_groups extension (by GetClientExtensions() will be ignored. The protocol will then add a suitable key_share extension to the ClientHello extensions.
GetExternalPsks()
Return the external PSKs to offer in the ClientHello.
public virtual IList<TlsPskExternal> GetExternalPsks()
Returns
- IList<TlsPskExternal>
an IList<T> of TlsPskExternal instances, or null if none should be offered.
Remarks
This will only be called when TLS 1.3 or higher is amongst the offered protocol versions.
GetMultiCertStatusRequest()
protected virtual IList<CertificateStatusRequestItemV2> GetMultiCertStatusRequest()
Returns
- IList<CertificateStatusRequestItemV2>
an IList<T> of CertificateStatusRequestItemV2 (or null).
GetNamedGroupRoles()
protected virtual IList<int> GetNamedGroupRoles()
Returns
GetNewConnectionID()
RFC 9146 DTLS connection ID.
protected virtual byte[] GetNewConnectionID()
Returns
- byte[]
The connection ID to use.
Remarks
The default GetClientExtensions() implementation calls this to get the connection_id extension the client will send. As future communication doesn't include the connection IDs length, this should either be fixed-length or include the connection ID's length. (see explanation in RFC 9146 4. "cid:")
GetProtocolNames()
protected virtual IList<ProtocolName> GetProtocolNames()
Returns
GetProtocolVersions()
public override ProtocolVersion[] GetProtocolVersions()
Returns
GetPskIdentity()
public virtual TlsPskIdentity GetPskIdentity()
Returns
Exceptions
GetSessionToResume()
Return the session this client wants to resume, if any.
public virtual TlsSession GetSessionToResume()
Returns
- TlsSession
A TlsSession representing the resumable session to be used for this connection, or null to use a new session.
Remarks
Note that the peer's certificate chain for the session (if any) may need to be periodically revalidated.
- See Also
GetSniServerNames()
protected virtual IList<ServerName> GetSniServerNames()
Returns
GetSrpConfigVerifier()
public virtual TlsSrpConfigVerifier GetSrpConfigVerifier()
Returns
Exceptions
GetSrpIdentity()
public virtual TlsSrpIdentity GetSrpIdentity()
Returns
Exceptions
GetSupportedGroups(IList<int>)
The default GetClientExtensions() implementation calls this to determine which named groups to include in the supported_groups extension for the ClientHello.
protected virtual IList<int> GetSupportedGroups(IList<int> namedGroupRoles)
Parameters
namedGroupRolesIList<int>The named group roles for which there should be at least one supported group. By default this is inferred from the offered cipher suites and signature algorithms.
Returns
- IList<int>
an IList<T> of int. See NamedGroup for group constants.
GetSupportedSignatureAlgorithms()
protected virtual IList<SignatureAndHashAlgorithm> GetSupportedSignatureAlgorithms()
Returns
GetSupportedSignatureAlgorithmsCert()
protected virtual IList<SignatureAndHashAlgorithm> GetSupportedSignatureAlgorithmsCert()
Returns
GetTrustedCAIndication()
protected virtual IList<TrustedAuthority> GetTrustedCAIndication()
Returns
Init(TlsClientContext)
public virtual void Init(TlsClientContext context)
Parameters
contextTlsClientContext
IsFallback()
public virtual bool IsFallback()
Returns
NotifyHandshakeBeginning()
public override void NotifyHandshakeBeginning()
Exceptions
NotifyNewSessionTicket(NewSessionTicket)
public virtual void NotifyNewSessionTicket(NewSessionTicket newSessionTicket)
Parameters
newSessionTicketNewSessionTicket
Exceptions
NotifySelectedCipherSuite(int)
public virtual void NotifySelectedCipherSuite(int selectedCipherSuite)
Parameters
selectedCipherSuiteint
NotifySelectedPsk(TlsPsk)
public virtual void NotifySelectedPsk(TlsPsk selectedPsk)
Parameters
selectedPskTlsPsk
Exceptions
NotifyServerVersion(ProtocolVersion)
public virtual void NotifyServerVersion(ProtocolVersion serverVersion)
Parameters
serverVersionProtocolVersion
Exceptions
NotifySessionID(byte[])
Notifies the client of the session_id sent in the ServerHello.
public virtual void NotifySessionID(byte[] sessionID)
Parameters
sessionIDbyte[]
- See Also
NotifySessionToResume(TlsSession)
Notifies the client of the session that will be offered in ClientHello for resumption, if any.
public virtual void NotifySessionToResume(TlsSession session)
Parameters
sessionTlsSessionThe TlsSession representing the resumable session to be offered for this connection, or null if there is none.
Remarks
This will be either the session returned from {@link #getSessionToResume()} or null if that session was unusable. NOTE: the actual negotiated session_id is notified by NotifySessionID(byte[]).
- See Also
ProcessServerExtensions(IDictionary<int, byte[]>)
public virtual void ProcessServerExtensions(IDictionary<int, byte[]> serverExtensions)
Parameters
serverExtensionsIDictionary<int, byte[]>
Exceptions
ProcessServerSupplementalData(IList<SupplementalDataEntry>)
public virtual void ProcessServerSupplementalData(IList<SupplementalDataEntry> serverSupplementalData)
Parameters
serverSupplementalDataIList<SupplementalDataEntry>
Exceptions
ShouldUseCompatibilityMode()
public virtual bool ShouldUseCompatibilityMode()