public abstract class AbstractTlsPeer extends java.lang.Object implements TlsPeer
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTlsPeer(TlsCrypto crypto) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowLegacyResumption() |
void |
cancel() |
TlsCrypto |
getCrypto() |
int |
getHandshakeTimeoutMillis()
NOTE: Currently only respected by DTLS protocols.
|
TlsHeartbeat |
getHeartbeat()
Return a
TlsHeartbeat instance that will control the generation of heartbeats locally
(if permitted by the remote peer), or null to not generate heartbeats. |
short |
getHeartbeatPolicy()
Return the heartbeat mode applicable to the remote peer.
|
TlsKeyExchangeFactory |
getKeyExchangeFactory() |
int |
getMaxCertificateChainLength() |
int |
getMaxHandshakeMessageSize() |
short[] |
getPskKeyExchangeModes() |
int |
getRenegotiationPolicy()
WARNING: EXPERIMENTAL FEATURE
Return this peer's policy on renegotiation requests from the remote peer.
|
protected abstract int[] |
getSupportedCipherSuites() |
protected ProtocolVersion[] |
getSupportedVersions()
Get the
ProtocolVersion values that are supported by this peer. |
void |
notifyAlertRaised(short alertLevel,
short alertDescription,
java.lang.String message,
java.lang.Throwable cause)
This method will be called when an alert is raised by the protocol.
|
void |
notifyAlertReceived(short alertLevel,
short alertDescription)
This method will be called when an alert is received from the remote peer.
|
void |
notifyCloseHandle(TlsCloseable closeHandle) |
void |
notifyHandshakeBeginning()
Notifies the peer that a new handshake is about to begin.
|
void |
notifyHandshakeComplete()
Notifies the peer that the handshake has been successfully completed.
|
void |
notifySecureRenegotiation(boolean secureRenegotiation)
RFC 5746 3.4/3.6.
|
boolean |
requiresCloseNotify()
This option is provided as a last resort for interoperability with TLS peers that fail to
correctly send a close_notify alert at end of stream.
|
boolean |
requiresExtendedMasterSecret()
This implementation supports RFC 7627 and will always negotiate the extended_master_secret
extension where possible.
|
boolean |
shouldCheckSigAlgOfPeerCerts()
Controls whether the protocol will check the 'signatureAlgorithm' of received certificates as
specified in RFC 5246 7.4.2, 7.4.4, 7.4.6 and similar rules for earlier TLS versions.
|
boolean |
shouldUseExtendedMasterSecret() |
boolean |
shouldUseExtendedPadding()
See RFC 5246 6.2.3.2.
|
boolean |
shouldUseGMTUnixTime()
draft-mathewson-no-gmtunixtime-00 2.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCipherSuites, getProtocolVersionsprotected AbstractTlsPeer(TlsCrypto crypto)
protected ProtocolVersion[] getSupportedVersions()
ProtocolVersion values that are supported by this peer.
WARNING: Mixing DTLS and TLS versions in the returned array is currently NOT supported. Use a
separate (sub-)class for each case.ProtocolVersion values.protected abstract int[] getSupportedCipherSuites()
public void cancel()
throws java.io.IOException
public void notifyCloseHandle(TlsCloseable closeHandle)
notifyCloseHandle in interface TlsPeerpublic void notifyHandshakeBeginning()
throws java.io.IOException
TlsPeernotifyHandshakeBeginning in interface TlsPeerjava.io.IOExceptionpublic int getHandshakeTimeoutMillis()
TlsPeerNOTE: Currently only respected by DTLS protocols.
Specify the timeout, in milliseconds, to use for the complete handshake process. Negative values are not allowed. A timeout of zero means an infinite timeout (i.e. the handshake will never time out).
getHandshakeTimeoutMillis in interface TlsPeerpublic boolean allowLegacyResumption()
allowLegacyResumption in interface TlsPeerpublic int getMaxCertificateChainLength()
getMaxCertificateChainLength in interface TlsPeerpublic int getMaxHandshakeMessageSize()
getMaxHandshakeMessageSize in interface TlsPeerpublic short[] getPskKeyExchangeModes()
getPskKeyExchangeModes in interface TlsPeerpublic boolean requiresCloseNotify()
TlsPeerrequiresCloseNotify in interface TlsPeerpublic boolean requiresExtendedMasterSecret()
TlsPeerrequiresExtendedMasterSecret in interface TlsPeertrue if the handshake should be aborted when the peer does not negotiate
the extended_master_secret extension, or false to support legacy
interoperability.public boolean shouldCheckSigAlgOfPeerCerts()
TlsPeershouldCheckSigAlgOfPeerCerts in interface TlsPeertrue if the 'signatureAlgorithm' of received certificates should be
checked, or false to skip those checks.public boolean shouldUseExtendedMasterSecret()
shouldUseExtendedMasterSecret in interface TlsPeerpublic boolean shouldUseExtendedPadding()
TlsPeershouldUseExtendedPadding in interface TlsPeertrue if random extra padding should be added during block cipher
encryption, or false to always use the minimum amount of required
padding.public boolean shouldUseGMTUnixTime()
TlsPeershouldUseGMTUnixTime in interface TlsPeertrue if the current time should be used in the gmt_unix_time field of
Random, or false if gmt_unix_time should contain a cryptographically
random value.public void notifySecureRenegotiation(boolean secureRenegotiation)
throws java.io.IOException
TlsPeernotifySecureRenegotiation in interface TlsPeerjava.io.IOExceptionpublic TlsKeyExchangeFactory getKeyExchangeFactory() throws java.io.IOException
getKeyExchangeFactory in interface TlsPeerjava.io.IOExceptionpublic void notifyAlertRaised(short alertLevel,
short alertDescription,
java.lang.String message,
java.lang.Throwable cause)
TlsPeernotifyAlertRaised in interface TlsPeeralertLevel - AlertLevelalertDescription - AlertDescriptionmessage - A human-readable message explaining what caused this alert. May be null.cause - The Throwable that caused this alert to be raised. May be null.public void notifyAlertReceived(short alertLevel,
short alertDescription)
TlsPeernotifyAlertReceived in interface TlsPeeralertLevel - AlertLevelalertDescription - AlertDescriptionpublic void notifyHandshakeComplete()
throws java.io.IOException
TlsPeernotifyHandshakeComplete in interface TlsPeerjava.io.IOExceptionpublic TlsHeartbeat getHeartbeat()
TlsPeerTlsHeartbeat instance that will control the generation of heartbeats locally
(if permitted by the remote peer), or null to not generate heartbeats. Heartbeats are
described in RFC 6520.getHeartbeat in interface TlsPeerTlsHeartbeat.DefaultTlsHeartbeatpublic short getHeartbeatPolicy()
TlsPeerReturn the heartbeat mode applicable to the remote peer. Heartbeats are described in RFC 6520.
See enumeration class HeartbeatMode for appropriate return values.
getHeartbeatPolicy in interface TlsPeerHeartbeatMode value.public int getRenegotiationPolicy()
TlsPeergetRenegotiationPolicy in interface TlsPeerRenegotiationPolicy constant corresponding to the desired policy.RenegotiationPolicy