The implementation of this class uses the QuicKeyManager to maintain
all state relating to keys for each encryption levels.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final long | |
| private final TransportContext | |
| private static final VarHandle | |
| private final QuicKeyManager. | |
| private volatile QuicTLSEngine. | |
| private volatile ByteBuffer | |
| private volatile QuicTLSEngine. | |
| private final QuicKeyManager. | |
| private volatile ByteBuffer | |
| private static final Map | |
| private volatile QuicVersion | |
| private final QuicKeyManager. | |
| private final String | |
| private final int | |
| private volatile QuicTransportParametersConsumer | |
| private volatile QuicTLSEngine. | |
| private static final Set |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | computeHeaderProtectionMask(QuicTLSEngine.
Implements jdk. Compute the header protection mask for the given sample, packet key space and direction (incoming/outgoing). |
| public void | consumeHandshakeBytes(QuicTLSEngine.
Implements jdk. This method consumes crypto stream. |
| public void | decryptPacket(final QuicTLSEngine.
Implements jdk. Decrypt the given packet bytes using keys for the given packet key space. |
| public void | |
| public void | deriveInitialKeys(final QuicVersion quicVersion, final ByteBuffer connectionId)
Implements jdk. Derive initial keys for the given QUIC version and connection ID |
| public void | |
| pack-priv void | deriveOneRTTKeys(final QuicVersion version, final SecretKey client_application_traffic_secret_0, final SecretKey server_application_traffic_secret_0, final CipherSuite negotiatedCipherSuite, final boolean clientMode)
|
| public void | discardKeys(QuicTLSEngine.
Implements jdk. Discard the keys used by the |
| public void | encryptPacket(final QuicTLSEngine.
Implements jdk. Encrypt into |
| pack-priv AlgorithmConstraints | Returns: theAlgorithmConstraints that are applicable for this engine,
or null if none are applicableReturns the |
| public String | getApplicationProtocol()
Implements jdk. Returns the most recent application protocol value negotiated by the engine. |
| public int | getAuthTagSize()
Implements jdk. Get the authentication tag size. |
| public QuicTLSEngine. | Returns: the current sending key spaceImplements jdk. Returns the current sending key space (encryption level) |
| public Runnable | getDelegatedTask()
Implements jdk. Returns a delegated |
| public ByteBuffer | getHandshakeBytes(QuicTLSEngine.
Implements jdk. If the current handshake state is |
| public SSLSession | getHandshakeSession()
Implements jdk. Returns the SSLSession being constructed during a QUIC handshake. |
| public QuicTLSEngine. | Returns: the HandshakeStateImplements jdk. Returns the current handshake state of the connection. |
| public int | getHeaderProtectionSampleSize(QuicTLSEngine.
Implements jdk. Get the sample size for header protection algorithm |
| public byte[] | |
| private QuicVersion | |
| public int | Returns: the key phase being used when decrypting incoming 1-RTT packetsReturns the key phase being used when decrypting incoming 1-RTT packets. |
| public String | getPeerHost()
Implements sun. Returns the host name of the peer. |
| public int | getPeerPort()
Implements sun. Returns the port number of the peer. |
| public SSLSession | |
| public SSLParameters | getSSLParameters()
Implements jdk. Returns the SSLParameters in effect for this engine. |
| public Set | getSupportedQuicVersions()
Implements jdk. Returns the QUIC versions supported by this engine. |
| public boolean | getUseClientMode()
Implements jdk. Returns true if this QuicTLSEngine is operating in client mode, false otherwise. |
| private void | |
| private boolean | |
| public boolean | isTLSHandshakeComplete()
Implements jdk. Returns true if the TLS handshake is considered complete. |
| private QuicKeyManager | |
| public boolean | keysAvailable(QuicTLSEngine.
Implements jdk. Checks whether the keys for the given key space are available. |
| pack-priv void | |
| private byte[] | |
| public void | restartHandshake()
Implements jdk. Reset the handshake state and produce a new ClientHello message. |
| public void | setLocalQuicTransportParameters(ByteBuffer params)
Implements jdk. Provide quic_transport_parameters for inclusion in handshake message. |
| public void | setOneRttContext(final QuicOneRttContext ctx)
Implements jdk. Sets the |
| public void | setRemoteQuicTransportParametersConsumer(QuicTransportParametersConsumer consumer)
Implements jdk. Set consumer for quic_transport_parameters sent by the remote side. |
| public void | setSSLParameters(final SSLParameters params)
Implements jdk. Sets the |
| public void | setUseClientMode(boolean mode)
Implements jdk. If |
| public void | signRetryPacket(final QuicVersion quicVersion, final ByteBuffer originalConnectionId, final ByteBuffer packet, final ByteBuffer output)
Implements jdk. Sign the provided retry packet. |
| public boolean | tryMarkHandshakeDone()
Implements jdk. Called to check if a |
| public boolean | tryReceiveHandshakeDone()
Implements jdk. Called when HANDSHAKE_DONE message is received from the server. |
| public boolean | useDelegatedTask()
Implements sun. Return true if delegated tasks used for handshaking operations. |
| public void | verifyRetryPacket(final QuicVersion quicVersion, final ByteBuffer originalConnectionId, final ByteBuffer packet)
Implements jdk. Verify the provided retry packet. |
| public void | versionNegotiated(final QuicVersion quicVersion)
Implements jdk. Called when the client and the server, during the connection creation handshake, have settled on a Quic version to use for the connection. |
| BASE_CRYPTO_ERROR | back to summary |
|---|---|
| pack-priv static final long BASE_CRYPTO_ERROR | |
| conContext | back to summary |
|---|---|
| private final TransportContext conContext | |
| HANDSHAKE_STATE_HANDLE | back to summary |
|---|---|
| private static final VarHandle HANDSHAKE_STATE_HANDLE | |
| handshakeKeyManager | back to summary |
|---|---|
| private final QuicKeyManager. | |
| handshakeState | back to summary |
|---|---|
| private volatile QuicTLSEngine. | |
| incomingCryptoBuffer | back to summary |
|---|---|
| private volatile ByteBuffer incomingCryptoBuffer | |
| incomingCryptoSpace | back to summary |
|---|---|
| private volatile QuicTLSEngine. | |
| initialKeyManager | back to summary |
|---|---|
| private final QuicKeyManager. | |
| localQuicTransportParameters | back to summary |
|---|---|
| private volatile ByteBuffer localQuicTransportParameters | |
| messageTypeMap | back to summary |
|---|---|
| private static final Map<Byte, QuicTLSEngine. | |
| negotiatedVersion | back to summary |
|---|---|
| private volatile QuicVersion negotiatedVersion | |
| oneRttKeyManager | back to summary |
|---|---|
| private final QuicKeyManager. | |
| peerHost | back to summary |
|---|---|
| private final String peerHost | |
| peerPort | back to summary |
|---|---|
| private final int peerPort | |
| remoteQuicTransportParametersConsumer | back to summary |
|---|---|
| private volatile QuicTransportParametersConsumer remoteQuicTransportParametersConsumer | |
| sendKeySpace | back to summary |
|---|---|
| private volatile QuicTLSEngine. | |
| SUPPORTED_QUIC_VERSIONS | back to summary |
|---|---|
| private static final Set<QuicVersion> SUPPORTED_QUIC_VERSIONS | |
| QuicTLSEngineImpl | back to summary |
|---|---|
| public QuicTLSEngineImpl(SSLContextImpl sslContextImpl) | |
| QuicTLSEngineImpl | back to summary |
|---|---|
| public QuicTLSEngineImpl(SSLContextImpl sslContextImpl, final String peerHost, final int peerPort) | |
| computeHeaderProtectionMask | back to summary |
|---|---|
| public ByteBuffer computeHeaderProtectionMask(QuicTLSEngine. Implements jdk. Doc from jdk. Compute the header protection mask for the given sample, packet key space and direction (incoming/outgoing).
| |
| consumeHandshakeBytes | back to summary |
|---|---|
| public void consumeHandshakeBytes(QuicTLSEngine. Implements jdk. Doc from jdk. This method consumes crypto stream.
| |
| decryptPacket | back to summary |
|---|---|
| public void decryptPacket(final QuicTLSEngine. Implements jdk. Doc from jdk. Decrypt the given packet bytes using keys for the given packet key space. Header protection must be removed before calling this method.
The input buffer contains the packet header and the encrypted packet payload.
The packet header (first The decrypted payload bytes are written to the output buffer. It is recommended to do the decryption in place by using slices of a bigger buffer as the input and output buffer:
+--------+-------------------+----------+
input: | header | encrypted payload | AEAD tag |
+--------+-------------------+----------+
output: | decrypted payload |
+-------------------+
| |
| deriveHandshakeKeys | back to summary |
|---|---|
| public void deriveHandshakeKeys() throws IOException | |
| deriveInitialKeys | back to summary |
|---|---|
| public void deriveInitialKeys(final QuicVersion quicVersion, final ByteBuffer connectionId) throws IOException Implements jdk. Doc from jdk. Derive initial keys for the given QUIC version and connection ID
| |
| deriveOneRTTKeys | back to summary |
|---|---|
| public void deriveOneRTTKeys() throws IOException | |
| deriveOneRTTKeys | back to summary |
|---|---|
| pack-priv void deriveOneRTTKeys(final QuicVersion version, final SecretKey client_application_traffic_secret_0, final SecretKey server_application_traffic_secret_0, final CipherSuite negotiatedCipherSuite, final boolean clientMode) throws IOException, GeneralSecurityException | |
| discardKeys | back to summary |
|---|---|
| public void discardKeys(QuicTLSEngine. Implements jdk. Doc from jdk. Discard the keys used by the
Once the keys for a particular
| |
| encryptPacket | back to summary |
|---|---|
| public void encryptPacket(final QuicTLSEngine. Implements jdk. Doc from jdk. Encrypt into
Before encrypting the
The
Upon return, the It is recommended to do the encryption in place by using slices of a bigger buffer as the input and output buffer:
+--------+-------------------+
input: | header | plaintext payload |
+--------+-------------------+----------+
output: | encrypted payload | AEAD tag |
+-------------------+----------+
| |
| getAlgorithmConstraints | back to summary |
|---|---|
| pack-priv AlgorithmConstraints getAlgorithmConstraints() Returns the
| |
| getApplicationProtocol | back to summary |
|---|---|
| public String getApplicationProtocol() Implements jdk. Doc from jdk. Returns the most recent application protocol value negotiated by the engine. Returns null if no application protocol has yet been negotiated by the engine.
| |
| getAuthTagSize | back to summary |
|---|---|
| public int getAuthTagSize() Implements jdk. Doc from jdk. Get the authentication tag size. Encryption adds this number of bytes.
| |
| getCurrentSendKeySpace | back to summary |
|---|---|
| public QuicTLSEngine. Implements jdk. Returns the current sending key space (encryption level)
| |
| getDelegatedTask | back to summary |
|---|---|
| public Runnable getDelegatedTask() Implements jdk. Doc from jdk. Returns a delegated
A call to this method will return each outstanding task exactly once. Multiple delegated tasks can be run in parallel.
| |
| getHandshakeBytes | back to summary |
|---|---|
| public ByteBuffer getHandshakeBytes(QuicTLSEngine. Implements jdk. Doc from jdk. If the current handshake state is
| |
| getHandshakeSession | back to summary |
|---|---|
| public SSLSession getHandshakeSession() Implements jdk. Doc from jdk. Returns the SSLSession being constructed during a QUIC handshake.
| |
| getHandshakeState | back to summary |
|---|---|
| public QuicTLSEngine. Implements jdk. Returns the current handshake state of the connection. Sometimes packets that could be decrypted can be received before the handshake has completed, but should not be decrypted until it is complete
| |
| getHeaderProtectionSampleSize | back to summary |
|---|---|
| public int getHeaderProtectionSampleSize(QuicTLSEngine. Implements jdk. Doc from jdk. Get the sample size for header protection algorithm
| |
| getLocalQuicTransportParameters | back to summary |
|---|---|
| public byte[] getLocalQuicTransportParameters() | |
| getNegotiatedVersion | back to summary |
|---|---|
| private QuicVersion getNegotiatedVersion() | |
| getOneRttKeyPhase | back to summary |
|---|---|
| public int getOneRttKeyPhase() throws QuicKeyUnavailableException Returns the key phase being used when decrypting incoming 1-RTT packets.
| |
| getPeerHost | back to summary |
|---|---|
| public String getPeerHost() Implements sun. Doc from sun. Returns the host name of the peer.
| |
| getPeerPort | back to summary |
|---|---|
| public int getPeerPort() Implements sun. Doc from sun. Returns the port number of the peer.
| |
| getSession | back to summary |
|---|---|
| public SSLSession getSession() Implements jdk. Doc from jdk. Returns the SSLSession.
| |
| getSSLParameters | back to summary |
|---|---|
| public SSLParameters getSSLParameters() Implements jdk. Doc from jdk. Returns the SSLParameters in effect for this engine.
| |
| getSupportedQuicVersions | back to summary |
|---|---|
| public Set Implements jdk. Doc from jdk. Returns the QUIC versions supported by this engine.
| |
| getUseClientMode | back to summary |
|---|---|
| public boolean getUseClientMode() Implements jdk. Doc from jdk. Returns true if this QuicTLSEngine is operating in client mode, false otherwise.
| |
| handleHandshakeMessage | back to summary |
|---|---|
| private void handleHandshakeMessage(QuicTLSEngine. | |
| isEnabled | back to summary |
|---|---|
| private boolean isEnabled(final QuicVersion quicVersion) | |
| isTLSHandshakeComplete | back to summary |
|---|---|
| public boolean isTLSHandshakeComplete() Implements jdk. Doc from jdk. Returns true if the TLS handshake is considered complete.
The TLS handshake is considered complete when the TLS stack
has reported that the handshake is complete. This happens when
the TLS stack has both sent a
| |
| keyManager | back to summary |
|---|---|
| private QuicKeyManager keyManager(final QuicTLSEngine. | |
| keysAvailable | back to summary |
|---|---|
| public boolean keysAvailable(QuicTLSEngine. Implements jdk. Doc from jdk. Checks whether the keys for the given key space are available. Keys are available when they are already computed and not discarded yet.
| |
| processRemoteQuicTransportParameters | back to summary |
|---|---|
| pack-priv void processRemoteQuicTransportParameters(ByteBuffer buffer) throws QuicTransportException | |
| produceNextHandshakeMessage | back to summary |
|---|---|
| private byte[] produceNextHandshakeMessage() throws IOException | |
| restartHandshake | back to summary |
|---|---|
| public void restartHandshake() throws IOException Implements jdk. Doc from jdk. Reset the handshake state and produce a new ClientHello message. When a Quic client receives a Version Negotiation packet, it restarts the handshake by calling this method after updating the transport parameters with the new version information.
| |
| setLocalQuicTransportParameters | back to summary |
|---|---|
| public void setLocalQuicTransportParameters(ByteBuffer params) Implements jdk. Doc from jdk. Provide quic_transport_parameters for inclusion in handshake message.
| |
| setOneRttContext | back to summary |
|---|---|
| public void setOneRttContext(final QuicOneRttContext ctx) Implements jdk. Doc from jdk. Sets the The
| |
| setRemoteQuicTransportParametersConsumer | back to summary |
|---|---|
| public void setRemoteQuicTransportParametersConsumer(QuicTransportParametersConsumer consumer) Implements jdk. Doc from jdk. Set consumer for quic_transport_parameters sent by the remote side. Consumer will receive a byte buffer containing the value of quic_transport_parameters extension sent by the remote endpoint.
| |
| setSSLParameters | back to summary |
|---|---|
| public void setSSLParameters(final SSLParameters params) Implements jdk. Doc from jdk. Sets the
| |
| setUseClientMode | back to summary |
|---|---|
| public void setUseClientMode(boolean mode) Implements jdk. Doc from jdk. If
| |
| signRetryPacket | back to summary |
|---|---|
| public void signRetryPacket(final QuicVersion quicVersion, final ByteBuffer originalConnectionId, final ByteBuffer packet, final ByteBuffer output) throws ShortBufferException, QuicTransportException Implements jdk. Doc from jdk. Sign the provided retry packet. Input buffer contains the retry packet payload. Integrity tag is stored in the output buffer.
| |
| tryMarkHandshakeDone | back to summary |
|---|---|
| public boolean tryMarkHandshakeDone() Implements jdk. Doc from jdk. Called to check if a
| |
| tryReceiveHandshakeDone | back to summary |
|---|---|
| public boolean tryReceiveHandshakeDone() Implements jdk. Doc from jdk. Called when HANDSHAKE_DONE message is received from the server. This
method will only be called for a
| |
| useDelegatedTask | back to summary |
|---|---|
| public boolean useDelegatedTask() Implements sun. Doc from sun. Return true if delegated tasks used for handshaking operations.
| |
| verifyRetryPacket | back to summary |
|---|---|
| public void verifyRetryPacket(final QuicVersion quicVersion, final ByteBuffer originalConnectionId, final ByteBuffer packet) throws AEADBadTagException, QuicTransportException Implements jdk. Doc from jdk. Verify the provided retry packet.
| |
| versionNegotiated | back to summary |
|---|---|
| public void versionNegotiated(final QuicVersion quicVersion) Implements jdk. Doc from jdk. Called when the client and the server, during the connection creation handshake, have settled on a Quic version to use for the connection. This can happen either due to an explicit version negotiation (as outlined in Quic RFC) or the server accepting the Quic version that the client chose in its first INITIAL packet. In either of those cases, this method will be called.
| |