public class ClientHandshaker extends Handshaker
Handshaker class.| Modifier and Type | Field and Description |
|---|---|
protected CertificateRequest |
certificateRequest
The server's
CertificateRequest. |
protected ClientHello |
clientHello
The client's hello handshake message.
|
protected ClientKeyExchange |
clientKeyExchange
The create client key exchange message.
|
protected byte[] |
handshakeHash
The hash of all received handshake messages sent in the finished message.
|
protected ServerNames |
indicatedServerNames |
protected Integer |
maxFragmentLengthCode |
protected SignatureAndHashAlgorithm |
negotiatedSignatureAndHashAlgorithm |
protected boolean |
sentClientCertificate
Indicates, that a none-empty client certificate is sent.
|
protected ECDHServerKeyExchange |
serverKeyExchange
The server's key exchange message
|
protected static HandshakeState[] |
SEVER_CERTIFICATE |
protected List<CertificateType> |
supportedClientCertificateTypes
The certificate types this peer supports for client authentication.
|
protected List<XECDHECryptography.SupportedGroup> |
supportedGroups
the supported groups (curves) ordered by preference
|
protected List<CertificateType> |
supportedServerCertificateTypes
The certificate types this peer supports for server authentication.
|
protected List<SignatureAndHashAlgorithm> |
supportedSignatureAlgorithms
The list of the signature and hash algorithms supported by the client
ordered by preference.
|
protected boolean |
truncateCertificatePath |
advancedPskStore, certificateChain, certificateVerfied, certificateVerifier, clientRandom, connectionIdGenerator, flightNumber, handshakeMessages, isClient, LOGGER, masterSecret, peerCertPath, privateKey, publicKey, reassembledMessage, recordSizeLimit, serverRandom, session, sniEnabled, states, statesIndex, usedProtocol, useKeyUsageVerification, useStateValidation, useTruncatedCertificatePathForVerification| Constructor and Description |
|---|
ClientHandshaker(DTLSSession session,
RecordLayer recordLayer,
ScheduledExecutorService timer,
Connection connection,
DtlsConnectorConfig config,
boolean probe)
Creates a new handshaker for negotiating a DTLS session with a server.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConnectionId(ClientHello helloMessage) |
protected void |
addMaxFragmentLength(ClientHello helloMessage) |
protected void |
addRecordSizeLimit(ClientHello helloMessage)
Add record size limit extension, if configured in
DtlsConnectorConfig.getRecordSizeLimit(). |
protected void |
addServerNameIndication(ClientHello helloMessage) |
protected void |
createCertificateMessage(DTLSFlight flight) |
protected void |
doProcessMessage(HandshakeMessage message)
Does the specific processing of a message received from a peer in
the course of an ongoing handshake.
|
protected PskPublicInformation |
getPskClientIdentity()
Get PSK client identity.
|
boolean |
isProbing()
Test, if handshake was started in probing mode.
|
boolean |
isRemovingConnection()
Check, if the connection must be removed.
|
protected static boolean |
isSupportedCertificateType(CertificateType certType,
List<CertificateType> supportedCertificateTypes)
Checks, if the provided certificate type is supported.
|
protected void |
processCertificateVerified()
Do the handshaker specific processing of successful verified certificates
|
protected void |
processMasterSecret(SecretKey masterSecret)
Do the handshaker specific master secret processing
|
protected void |
receivedHelloVerifyRequest(HelloVerifyRequest message)
A
HelloVerifyRequest is sent by the server upon the arrival of
the client's ClientHello. |
protected void |
receivedServerHello(ServerHello message)
Stores the negotiated security parameters.
|
void |
resetProbing()
Reset probing mode, when data is received during.
|
void |
startHandshake()
Starts the handshake by sending the first flight to the peer.
|
protected void |
verifyServerHelloExtensions(ServerHello message) |
addApplicationDataForDeferredProcessing, addRecordsForDeferredProcessing, addSessionListener, applyMasterSecret, calculateKeys, completePendingFlight, createFlight, destroy, ensureUndestroyed, expectChangeCipherSpecMessage, expectMessage, generateRandomSeed, getClientRandom, getConnection, getFailureCause, getHandshakeMessageDigest, getPeerAddress, getReadConnectionId, getServerRandom, getSession, handshakeAborted, handshakeCompleted, handshakeFailed, handshakeFlightRetransmitted, handshakeStarted, hasSessionEstablished, isChangeCipherSpecMessageExpected, isDestroyed, isExpired, isInboundMessageProcessed, isPskRequestPending, processAsyncHandshakeResult, processAsyncPskSecretResult, processCertificateVerificationResult, processMessage, processPskSecretResult, reassembleFragment, removeSessionListener, requestPskSecretResult, sendFlight, sendLastFlight, sessionEstablished, setCurrentReadState, setCurrentWriteState, setFailureCause, setGenerateClusterMacKeys, takeDeferredApplicationData, takeDeferredApplicationData, takeDeferredRecords, verifyCertificate, wrapMessageprotected static HandshakeState[] SEVER_CERTIFICATE
protected ECDHServerKeyExchange serverKeyExchange
protected ClientKeyExchange clientKeyExchange
protected ClientHello clientHello
protected final List<XECDHECryptography.SupportedGroup> supportedGroups
protected final Integer maxFragmentLengthCode
protected final boolean truncateCertificatePath
protected final List<CertificateType> supportedClientCertificateTypes
protected final List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms
protected final List<CertificateType> supportedServerCertificateTypes
protected CertificateRequest certificateRequest
CertificateRequest. Optional.protected boolean sentClientCertificate
protected byte[] handshakeHash
protected ServerNames indicatedServerNames
protected SignatureAndHashAlgorithm negotiatedSignatureAndHashAlgorithm
public ClientHandshaker(DTLSSession session, RecordLayer recordLayer, ScheduledExecutorService timer, Connection connection, DtlsConnectorConfig config, boolean probe)
session - the session to negotiate with the server.recordLayer - the object to use for sending flights to the peer.timer - scheduled executor for flight retransmission (since 2.4).connection - the connection related with the session.config - the DTLS configuration.probe - true enable probing for this handshake,
false, not probing handshake.IllegalStateException - if the message digest required for computing the FINISHED message hash cannot be instantiated.NullPointerException - if session, recordLayer, timer or config is nullprotected void doProcessMessage(HandshakeMessage message) throws HandshakeException, GeneralSecurityException
HandshakerdoProcessMessage in class Handshakermessage - the message received from the peerHandshakeException - if the record's plaintext fragment cannot be parsed into
a handshake message or cannot be processed properlyGeneralSecurityException - if the record's ciphertext fragment cannot be decryptedprotected void receivedHelloVerifyRequest(HelloVerifyRequest message) throws HandshakeException
HelloVerifyRequest is sent by the server upon the arrival of
the client's ClientHello. It is sent by the server to prevent
flooding of a client. The client answers with the same
ClientHello as before with the additional cookie.message - the server's HelloVerifyRequest.HandshakeException - if the CLIENT_HELLO record cannot be createdprotected void receivedServerHello(ServerHello message) throws HandshakeException
message - the ServerHello message.HandshakeException - if the ServerHello message cannot be processed,
e.g. because the server selected an unknown or unsupported cipher suiteprotected void verifyServerHelloExtensions(ServerHello message) throws HandshakeException
HandshakeExceptionprotected void processMasterSecret(SecretKey masterSecret) throws HandshakeException
processMasterSecret in class HandshakermasterSecret - master secretHandshakeException - if an error occursprotected void processCertificateVerified()
throws HandshakeException
processCertificateVerified in class HandshakerHandshakeException - if an error occursprotected void createCertificateMessage(DTLSFlight flight) throws HandshakeException
HandshakeExceptionprotected static boolean isSupportedCertificateType(CertificateType certType, List<CertificateType> supportedCertificateTypes)
certType - certificate typesupportedCertificateTypes - list of supported certificate type. if
null, only CertificateType.X_509 is supported.true, if supported, false otherwise.public void startHandshake()
throws HandshakeException
HandshakerThe particular message to be sent depends on this peer's role in the handshake, i.e. if this end represents the client or server.
startHandshake in class HandshakerHandshakeException - if the message to start the handshake cannot be
created and sent using the session's current security parameters.protected void addRecordSizeLimit(ClientHello helloMessage)
DtlsConnectorConfig.getRecordSizeLimit().helloMessage - client hello to add RecordSizeLimitExtension.protected void addMaxFragmentLength(ClientHello helloMessage)
protected void addConnectionId(ClientHello helloMessage)
protected void addServerNameIndication(ClientHello helloMessage)
protected PskPublicInformation getPskClientIdentity() throws HandshakeException
DTLSSession.getPeer()HandshakeException - if no identity is available for the
destinationpublic boolean isProbing()
HandshakerisProbing in class Handshakertrue, if handshake is in probing mode, false,
otherwise.ResumingClientHandshakerpublic void resetProbing()
HandshakerresetProbing in class HandshakerResumingClientHandshakerpublic boolean isRemovingConnection()
Handshaker.handshakeFailed(Throwable)
was called, and the connection has no established session.
Connections of probing handshakes are not intended to be removed.isRemovingConnection in class Handshakertrue, remove the connection, false, keep it.Copyright © 2023 Eclipse Foundation. All rights reserved.