Top Description Fields Constructors Methods
org.bouncycastle.tls

public abstract Class AbstractTlsServer

extends AbstractTlsPeer
implements TlsServer
Class Inheritance
All Implemented Interfaces
org.bouncycastle.tls.TlsServer, org.bouncycastle.tls.TlsPeer
Known Direct Subclasses
org.bouncycastle.tls.SRPTlsServer, org.bouncycastle.tls.DefaultTlsServer, org.bouncycastle.tls.PSKTlsServer
Imports
java.io.IOException, java.util.Hashtable, .Vector, org.bouncycastle.tls.crypto.TlsCrypto, .TlsDHConfig, .TlsECConfig, org.bouncycastle.util.Integers

Base class for a TLS server.

Field Summary

Modifier and TypeField and Description
protected CertificateStatusRequest
protected int[]
protected Hashtable<K, V>
protected Vector<E>
protected boolean
protected TlsServerContext
protected boolean
protected short
protected int[]
protected ProtocolVersion[]
protected int
protected ProtocolName
protected final Hashtable<K, V>
protected Vector<E>
protected boolean
protected Vector<E>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected Hashtable<K, V>
checkServerExtensions()

Deprecated Use 'serverExtensions' directly, it is now never null
protected short[]
public CertificateRequest
public CertificateStatus
getCertificateStatus()

Implements org.bouncycastle.tls.TlsServer.getCertificateStatus.

This method will be called (only) if the server included an extension of type "status_request" with empty "extension_data" in the extended server hello.
public int[]
protected String
public TlsDHConfig
public TlsECConfig
public TlsPSKExternal
getExternalPSK(Vector<E>
a Vector of PskIdentity instances.
identities
)

Implements org.bouncycastle.tls.TlsServer.getExternalPSK.

Warning

EXPERIMENTAL FEATURE, UNSTABLE API Return the external PSK to select from the ClientHello.

protected int
protected int
protected byte[]

Returns:

The connection ID to use.
getNewConnectionID
()

RFC 9146 DTLS connection ID.

This method will be called if a connection_id extension was sent by the client.

public byte[]
public NewSessionTicket
protected Vector<E>
public ProtocolVersion[]
public TlsPSKIdentityManager
public int
public Hashtable<K, V>
public void
public Vector<E>
public ProtocolVersion
public TlsSession
getSessionToResume(byte[]
the ID of the session to resume.
sessionID
)

Implements org.bouncycastle.tls.TlsServer.getSessionToResume.

Return the specified session, if available.
public TlsSRPLoginParameters
public int[]
public void
protected boolean
isSelectableCipherSuite(int cipherSuite, int availCurveBits, int availFiniteFieldBits, Vector<E> sigAlgs)

public void
notifyClientCertificate(Certificate
the effective client certificate (may be an empty chain).
clientCertificate
)

Implements org.bouncycastle.tls.TlsServer.notifyClientCertificate.

Called by the protocol handler to report the client certificate, only if getCertificateRequest() returned non-null.
public void
public void
public void
public void
public void
protected boolean
protected boolean
public void
public void
protected boolean
selectCipherSuite(int cipherSuite)

protected int
selectDH(int minimumFiniteFieldBits)

protected int
selectDHDefault(int minimumFiniteFieldBits)

protected int
selectECDH(int minimumCurveBits)

protected int
selectECDHDefault(int minimumCurveBits)

protected ProtocolName
protected ProtocolName
selectProtocolName(Vector<E> clientProtocolNames, Vector<E> serverProtocolNames)

protected boolean
Inherited from org.bouncycastle.tls.AbstractTlsPeer:
allowLegacyResumptioncancelgetCryptogetHandshakeResendTimeMillisgetHandshakeTimeoutMillisgetHeartbeatgetHeartbeatPolicygetKeyExchangeFactorygetMaxCertificateChainLengthgetMaxHandshakeMessageSizegetPskKeyExchangeModesgetRenegotiationPolicygetSupportedCipherSuitesgetSupportedVersionsnotifyAlertRaisednotifyAlertReceivednotifyCloseHandlenotifyConnectionClosednotifyHandshakeCompletenotifySecureRenegotiationrequiresCloseNotifyrequiresExtendedMasterSecretshouldCheckSigAlgOfPeerCertsshouldUseExtendedMasterSecretshouldUseExtendedPaddingshouldUseGMTUnixTime

Field Detail

certificateStatusRequestback to summary
protected CertificateStatusRequest certificateStatusRequest
cipherSuitesback to summary
protected int[] cipherSuites
clientExtensionsback to summary
protected Hashtable<K, V> clientExtensions
clientProtocolNamesback to summary
protected Vector<E> clientProtocolNames
clientSentECPointFormatsback to summary
protected boolean clientSentECPointFormats
contextback to summary
protected TlsServerContext context
encryptThenMACOfferedback to summary
protected boolean encryptThenMACOffered
maxFragmentLengthOfferedback to summary
protected short maxFragmentLengthOffered
offeredCipherSuitesback to summary
protected int[] offeredCipherSuites
protocolVersionsback to summary
protected ProtocolVersion[] protocolVersions
selectedCipherSuiteback to summary
protected int selectedCipherSuite
selectedProtocolNameback to summary
protected ProtocolName selectedProtocolName
serverExtensionsback to summary
protected final Hashtable<K, V> serverExtensions
statusRequestV2back to summary
protected Vector<E> statusRequestV2
truncatedHMacOfferedback to summary
protected boolean truncatedHMacOffered
trustedCAKeysback to summary
protected Vector<E> trustedCAKeys

Constructor Detail

AbstractTlsServerback to summary
public AbstractTlsServer(TlsCrypto crypto)

Method Detail

allowCertificateStatusback to summary
protected boolean allowCertificateStatus()
allowEncryptThenMACback to summary
protected boolean allowEncryptThenMAC()
allowMultiCertStatusback to summary
protected boolean allowMultiCertStatus()
allowTruncatedHMacback to summary
protected boolean allowTruncatedHMac()
allowTrustedCAIndicationback to summary
protected boolean allowTrustedCAIndication()
checkServerExtensionsback to summary
protected Hashtable<K, V> checkServerExtensions()

Deprecated

Use 'serverExtensions' directly, it is now never null

getAllowedClientCertificateTypesback to summary
protected short[] getAllowedClientCertificateTypes()
getCertificateRequestback to summary
public CertificateRequest getCertificateRequest() throws IOException

Implements org.bouncycastle.tls.TlsServer.getCertificateRequest.

getCertificateStatusback to summary
public CertificateStatus getCertificateStatus() throws IOException

Implements org.bouncycastle.tls.TlsServer.getCertificateStatus.

Doc from org.bouncycastle.tls.TlsServer.getCertificateStatus.

This method will be called (only) if the server included an extension of type "status_request" with empty "extension_data" in the extended server hello. See RFC 3546 3.6. Certificate Status Request. If a non-null CertificateStatus is returned, it is sent to the client as a handshake message of type "certificate_status".

Returns:CertificateStatus

A CertificateStatus to be sent to the client (or null for none).

getCipherSuitesback to summary
public int[] getCipherSuites()

Implements org.bouncycastle.tls.TlsPeer.getCipherSuites.

getDetailMessageNoCipherSuiteback to summary
protected String getDetailMessageNoCipherSuite()
getDHConfigback to summary
public TlsDHConfig getDHConfig() throws IOException

Implements org.bouncycastle.tls.TlsServer.getDHConfig.

getECDHConfigback to summary
public TlsECConfig getECDHConfig() throws IOException

Implements org.bouncycastle.tls.TlsServer.getECDHConfig.

getExternalPSKback to summary
public TlsPSKExternal getExternalPSK(Vector<E> identities)

Implements org.bouncycastle.tls.TlsServer.getExternalPSK.

Doc from org.bouncycastle.tls.TlsServer.getExternalPSK.

Warning

EXPERIMENTAL FEATURE, UNSTABLE API Return the external PSK to select from the ClientHello. Note that this will only be called when TLS 1.3 or higher is amongst the offered protocol versions, and one or more PSKs are actually offered.

Parameters
identities:Vector<E>

a Vector of PskIdentity instances.

Returns:TlsPSKExternal

the TlsPSKExternal corresponding to the selected identity, or null to not select any.

getMaximumNegotiableCurveBitsback to summary
protected int getMaximumNegotiableCurveBits()
getMaximumNegotiableFiniteFieldBitsback to summary
protected int getMaximumNegotiableFiniteFieldBits()
getNewConnectionIDback to summary
protected byte[] getNewConnectionID()

RFC 9146 DTLS connection ID.

This method will be called if a connection_id extension was sent by the client. If the return value is non-null, the server will send this connection ID to the client to use in future packets. 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:")

Returns:byte[]

The connection ID to use.

getNewSessionIDback to summary
public byte[] getNewSessionID()

Implements org.bouncycastle.tls.TlsServer.getNewSessionID.

getNewSessionTicketback to summary
public NewSessionTicket getNewSessionTicket() throws IOException

Implements org.bouncycastle.tls.TlsServer.getNewSessionTicket.

Doc from org.bouncycastle.tls.TlsServer.getNewSessionTicket.

RFC 5077 3.3. NewSessionTicket Handshake Message.

This method will be called (only) if a NewSessionTicket extension was sent by the server. See RFC 5077 4. Recommended Ticket Construction for recommended format and protection.

Returns:NewSessionTicket

The ticket.

getProtocolNamesback to summary
protected Vector<E> getProtocolNames()
getProtocolVersionsback to summary
public ProtocolVersion[] getProtocolVersions()

Implements org.bouncycastle.tls.TlsPeer.getProtocolVersions.

getPSKIdentityManagerback to summary
public TlsPSKIdentityManager getPSKIdentityManager() throws IOException

Implements org.bouncycastle.tls.TlsServer.getPSKIdentityManager.

getSelectedCipherSuiteback to summary
public int getSelectedCipherSuite() throws IOException

Implements org.bouncycastle.tls.TlsServer.getSelectedCipherSuite.

getServerExtensionsback to summary
public Hashtable<K, V> getServerExtensions() throws IOException

Implements org.bouncycastle.tls.TlsServer.getServerExtensions.

getServerExtensionsForConnectionback to summary
public void getServerExtensionsForConnection(Hashtable<K, V> serverExtensions) throws IOException

Implements org.bouncycastle.tls.TlsServer.getServerExtensionsForConnection.

getServerSupplementalDataback to summary
public Vector<E> getServerSupplementalData() throws IOException

Implements org.bouncycastle.tls.TlsServer.getServerSupplementalData.

getServerVersionback to summary
public ProtocolVersion getServerVersion() throws IOException

Implements org.bouncycastle.tls.TlsServer.getServerVersion.

getSessionToResumeback to summary
public TlsSession getSessionToResume(byte[] sessionID)

Implements org.bouncycastle.tls.TlsServer.getSessionToResume.

Doc from org.bouncycastle.tls.TlsServer.getSessionToResume.

Return the specified session, if available. Note that the peer's certificate chain for the session (if any) may need to be periodically revalidated.

Parameters
sessionID:byte[]

the ID of the session to resume.

Returns:TlsSession

A TlsSession with the specified session ID, or null.

getSRPLoginParametersback to summary
public TlsSRPLoginParameters getSRPLoginParameters() throws IOException

Implements org.bouncycastle.tls.TlsServer.getSRPLoginParameters.

getSupportedGroupsback to summary
public int[] getSupportedGroups() throws IOException

Implements org.bouncycastle.tls.TlsServer.getSupportedGroups.

initback to summary
public void init(TlsServerContext context)

Implements org.bouncycastle.tls.TlsServer.init.

isSelectableCipherSuiteback to summary
protected boolean isSelectableCipherSuite(int cipherSuite, int availCurveBits, int availFiniteFieldBits, Vector<E> sigAlgs)
notifyClientCertificateback to summary
public void notifyClientCertificate(Certificate clientCertificate) throws IOException

Implements org.bouncycastle.tls.TlsServer.notifyClientCertificate.

Doc from org.bouncycastle.tls.TlsServer.notifyClientCertificate.

Called by the protocol handler to report the client certificate, only if getCertificateRequest() returned non-null.

Note

this method is responsible for certificate verification and validation.

Parameters
clientCertificate:Certificate

the effective client certificate (may be an empty chain).

notifyClientVersionback to summary
public void notifyClientVersion(ProtocolVersion clientVersion) throws IOException

Implements org.bouncycastle.tls.TlsServer.notifyClientVersion.

notifyFallbackback to summary
public void notifyFallback(boolean isFallback) throws IOException

Implements org.bouncycastle.tls.TlsServer.notifyFallback.

notifyHandshakeBeginningback to summary
public void notifyHandshakeBeginning() throws IOException

Overrides org.bouncycastle.tls.AbstractTlsPeer.notifyHandshakeBeginning.

Implements org.bouncycastle.tls.TlsPeer.notifyHandshakeBeginning.

Doc from org.bouncycastle.tls.TlsPeer.notifyHandshakeBeginning.

Notifies the peer that a new handshake is about to begin.

notifyOfferedCipherSuitesback to summary
public void notifyOfferedCipherSuites(int[] offeredCipherSuites) throws IOException

Implements org.bouncycastle.tls.TlsServer.notifyOfferedCipherSuites.

notifySessionback to summary
public void notifySession(TlsSession session)

Implements org.bouncycastle.tls.TlsServer.notifySession.

preferLocalCipherSuitesback to summary
protected boolean preferLocalCipherSuites()
preferLocalClientCertificateTypesback to summary
protected boolean preferLocalClientCertificateTypes()
processClientExtensionsback to summary
public void processClientExtensions(Hashtable<K, V> clientExtensions) throws IOException

Implements org.bouncycastle.tls.TlsServer.processClientExtensions.

processClientSupplementalDataback to summary
public void processClientSupplementalData(Vector<E> clientSupplementalData) throws IOException

Implements org.bouncycastle.tls.TlsServer.processClientSupplementalData.

selectCipherSuiteback to summary
protected boolean selectCipherSuite(int cipherSuite) throws IOException
selectDHback to summary
protected int selectDH(int minimumFiniteFieldBits)
selectDHDefaultback to summary
protected int selectDHDefault(int minimumFiniteFieldBits)
selectECDHback to summary
protected int selectECDH(int minimumCurveBits)
selectECDHDefaultback to summary
protected int selectECDHDefault(int minimumCurveBits)
selectProtocolNameback to summary
protected ProtocolName selectProtocolName() throws IOException
selectProtocolNameback to summary
protected ProtocolName selectProtocolName(Vector<E> clientProtocolNames, Vector<E> serverProtocolNames)
shouldSelectProtocolNameEarlyback to summary
protected boolean shouldSelectProtocolNameEarly()