- java.lang.Object
-
- net.luminis.tls.engine.impl.TlsEngineImpl
-
- net.luminis.tls.engine.impl.TlsServerEngineImpl
-
- All Implemented Interfaces:
MessageProcessor,ServerMessageProcessor,TlsEngine,TlsServerEngine,TrafficSecrets
public class TlsServerEngineImpl extends TlsEngineImpl implements TlsServerEngine, ServerMessageProcessor
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsStatusEventHandlerstatusHandler-
Fields inherited from class net.luminis.tls.engine.impl.TlsEngineImpl
algorithmMapping, privateKey, publicKey, state
-
-
Constructor Summary
Constructors Constructor Description TlsServerEngineImpl(java.security.cert.X509Certificate serverCertificate, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)TlsServerEngineImpl(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)Adds extension to the list of extensions to be included in the EncryptedExtensions message.voidaddSupportedCiphers(java.util.List<TlsConstants.CipherSuite> cipherSuites)Adds ciphers to the list of the symmetric cipher options supported by the server (specifically the record protection algorithm (including secret key length) and a hash to be used with HKDF), in descending order of server preference.TlsConstants.CipherSuitegetSelectedCipher()Get the selected (negotiated) cipher suite.java.util.List<Extension>getServerExtensions()Returns the list of extensions actually included in the EncryptedExtensions message.voidreceived(ClientHello clientHello, ProtectionKeysType protectedBy)voidreceived(FinishedMessage clientFinished, ProtectionKeysType protectedBy)voidsetSelectedApplicationLayerProtocol(java.lang.String applicationProtocol)Sets the negotiated application layer protocol.voidsetServerMessageSender(ServerMessageSender serverMessageSender)Sets the callback used for sending server messages (to the client).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)Sets the callback used for notifying the status of the TLS connection.protected booleanvalidateBinder(ClientHelloPreSharedKeyExtension.PskBinderEntry pskBinderEntry, int binderPosition, ClientHello clientHello)-
Methods inherited from class net.luminis.tls.engine.impl.TlsEngineImpl
computeFinishedVerifyData, computeSignature, generateKeys, getClientApplicationTrafficSecret, getClientEarlyTrafficSecret, getClientHandshakeTrafficSecret, getServerApplicationTrafficSecret, getServerHandshakeTrafficSecret, getSignatureAlgorithm, hashLength, keyLength, recognizedExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.luminis.tls.engine.ServerMessageProcessor
received, received, received, received, received, received
-
Methods inherited from interface net.luminis.tls.engine.TrafficSecrets
getClientApplicationTrafficSecret, getClientEarlyTrafficSecret, getClientHandshakeTrafficSecret, getServerApplicationTrafficSecret, getServerHandshakeTrafficSecret
-
-
-
-
Field Detail
-
statusHandler
protected TlsStatusEventHandler statusHandler
-
-
Constructor Detail
-
TlsServerEngineImpl
public TlsServerEngineImpl(java.util.List<java.security.cert.X509Certificate> certificates, java.security.PrivateKey certificateKey, ServerMessageSender serverMessageSender, TlsStatusEventHandler tlsStatusHandler, TlsSessionRegistry tlsSessionRegistry)
-
TlsServerEngineImpl
public TlsServerEngineImpl(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- Specified by:
receivedin interfaceTlsServerEngine- Throws:
TlsProtocolExceptionjava.io.IOException
-
received
public void received(FinishedMessage clientFinished, ProtectionKeysType protectedBy) throws TlsProtocolException, java.io.IOException
- Specified by:
receivedin interfaceMessageProcessor- Specified by:
receivedin interfaceTlsServerEngine- 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)
Description copied from interface:TlsServerEngineAdds ciphers to the list of the symmetric cipher options supported by the server (specifically the record protection algorithm (including secret key length) and a hash to be used with HKDF), in descending order of server preference. By default, the server supports TLS_AES_128_GCM_SHA256.- Specified by:
addSupportedCiphersin interfaceTlsServerEngine
-
setServerMessageSender
public void setServerMessageSender(ServerMessageSender serverMessageSender)
Description copied from interface:TlsServerEngineSets the callback used for sending server messages (to the client).- Specified by:
setServerMessageSenderin interfaceTlsServerEngine
-
setStatusHandler
public void setStatusHandler(TlsStatusEventHandler statusHandler)
Description copied from interface:TlsServerEngineSets the callback used for notifying the status of the TLS connection.- Specified by:
setStatusHandlerin interfaceTlsServerEngine
-
getSelectedCipher
public TlsConstants.CipherSuite getSelectedCipher()
Description copied from interface:TlsServerEngineGet the selected (negotiated) cipher suite.- Specified by:
getSelectedCipherin interfaceTlsServerEngine- Specified by:
getSelectedCipherin classTlsEngineImpl- Returns:
-
getServerExtensions
public java.util.List<Extension> getServerExtensions()
Description copied from interface:TlsServerEngineReturns the list of extensions actually included in the EncryptedExtensions message.- Specified by:
getServerExtensionsin interfaceTlsServerEngine- Returns:
-
addServerExtensions
public void addServerExtensions(Extension extension)
Description copied from interface:TlsServerEngineAdds extension to the list of extensions to be included in the EncryptedExtensions message.- Specified by:
addServerExtensionsin interfaceTlsServerEngine
-
setSelectedApplicationLayerProtocol
public void setSelectedApplicationLayerProtocol(java.lang.String applicationProtocol)
Description copied from interface:TlsServerEngineSets the negotiated application layer protocol.- Specified by:
setSelectedApplicationLayerProtocolin interfaceTlsServerEngine
-
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.- Specified by:
setSessionDatain interfaceTlsServerEngine- 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.- Specified by:
setSessionDataVerificationCallbackin interfaceTlsServerEngine- Parameters:
callback- the callback that is called with the stored session data; when the callback returns false the session will not be resumed.
-
-