Package net.luminis.tls.handshake
Class TlsServerEngine
- java.lang.Object
-
- net.luminis.tls.handshake.TlsEngine
-
- net.luminis.tls.handshake.TlsServerEngine
-
- All Implemented Interfaces:
MessageProcessor,ServerMessageProcessor,TrafficSecrets
public class TlsServerEngine extends TlsEngine implements ServerMessageProcessor
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsStatusEventHandlerstatusHandler-
Fields inherited from class net.luminis.tls.handshake.TlsEngine
algorithmMapping, privateKey, publicKey, state
-
-
Constructor Summary
Constructors Constructor Description TlsServerEngine(java.security.cert.X509Certificate serverCertificate, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)TlsServerEngine(java.util.List<java.security.cert.X509Certificate> certificates, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddServerExtensions(Extension extension)voidaddSupportedCiphers(java.util.List<TlsConstants.CipherSuite> cipherSuites)TlsConstants.CipherSuitegetSelectedCipher()java.util.List<Extension>getServerExtensions()voidreceived(ClientHello clientHello, ProtectionKeysType protectedBy)voidreceived(FinishedMessage clientFinished, ProtectionKeysType protectedBy)voidsetSelectedApplicationLayerProtocol(java.lang.String applicationProtocol)voidsetServerMessageSender(ServerMessageSender serverMessageSender)voidsetSessionData(byte[] additionalSessionData)Set (other layer's) session data for this session.voidsetSessionDataVerificationCallback(java.util.function.Function<java.nio.ByteBuffer,java.lang.Boolean> callback)Set the callback that is called before a session is (successfully) resumed.voidsetStatusHandler(TlsStatusEventHandler statusHandler)protected booleanvalidateBinder(ClientHelloPreSharedKeyExtension.PskBinderEntry pskBinderEntry, int binderPosition, ClientHello clientHello)-
Methods inherited from class net.luminis.tls.handshake.TlsEngine
computeFinishedVerifyData, computeSignature, generateKeys, getClientApplicationTrafficSecret, getClientEarlyTrafficSecret, getClientHandshakeTrafficSecret, getServerApplicationTrafficSecret, getServerHandshakeTrafficSecret, getSignatureAlgorithm, hashLength, keyLength
-
-
-
-
Field Detail
-
statusHandler
protected TlsStatusEventHandler statusHandler
-
-
Constructor Detail
-
TlsServerEngine
public TlsServerEngine(java.util.List<java.security.cert.X509Certificate> certificates, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)
-
TlsServerEngine
public TlsServerEngine(java.security.cert.X509Certificate serverCertificate, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)
-
-
Method Detail
-
received
public void received(ClientHello clientHello, ProtectionKeysType protectedBy) throws TlsProtocolException, java.io.IOException
- Specified by:
receivedin interfaceMessageProcessor- Throws:
TlsProtocolExceptionjava.io.IOException
-
received
public void received(FinishedMessage clientFinished, ProtectionKeysType protectedBy) throws TlsProtocolException, java.io.IOException
- Specified by:
receivedin interfaceMessageProcessor- Throws:
TlsProtocolExceptionjava.io.IOException
-
validateBinder
protected boolean validateBinder(ClientHelloPreSharedKeyExtension.PskBinderEntry pskBinderEntry, int binderPosition, ClientHello clientHello)
-
addSupportedCiphers
public void addSupportedCiphers(java.util.List<TlsConstants.CipherSuite> cipherSuites)
-
setServerMessageSender
public void setServerMessageSender(ServerMessageSender serverMessageSender)
-
setStatusHandler
public void setStatusHandler(TlsStatusEventHandler statusHandler)
-
getSelectedCipher
public TlsConstants.CipherSuite getSelectedCipher()
- Specified by:
getSelectedCipherin classTlsEngine
-
getServerExtensions
public java.util.List<Extension> getServerExtensions()
-
addServerExtensions
public void addServerExtensions(Extension extension)
-
setSelectedApplicationLayerProtocol
public void setSelectedApplicationLayerProtocol(java.lang.String applicationProtocol)
-
setSessionData
public void setSessionData(byte[] additionalSessionData)
Set (other layer's) session data for this session. When this session is resumed (with a session ticket), this data will be provided to the session data verification callback, which enables the application layer to accept or deny the session resumption based on the data stored in the session. For example, with QUIC this is used to store the QUIC version in the session data, so when the session is resumed, the QUIC layer can verify the same QUIC version is used.- Parameters:
additionalSessionData-
-
setSessionDataVerificationCallback
public void setSessionDataVerificationCallback(java.util.function.Function<java.nio.ByteBuffer,java.lang.Boolean> callback)
Set the callback that is called before a session is (successfully) resumed. If there is no data associated with the session, the callback is not called and verification is assumed to be successful, i.e. the session will be resumed.- Parameters:
callback- the callback that is called with the stored session data; when the callback returns false the session will not be resumed.
-
-