@Test public void testAdjustTlsContextAfterSerializedTls13ClientOutbound() { FinishedMessage message = new FinishedMessage(); context.setRecordLayer(RecordLayerFactory.getRecordLayer(RecordLayerType.RECORD, context)); context.setTalkingConnectionEndType(ConnectionEndType.CLIENT); context.setConnection(new OutboundConnection()); context.setSelectedProtocolVersion(ProtocolVersion.TLS13); context.setHandshakeSecret(new byte[] { 0, 1, 2, 3, 4 }); context.setSelectedCipherSuite(CipherSuite.TLS_AES_128_GCM_SHA256); message.setVerifyData(new byte[] { 0, 1, 2, 3, 4 }); context.setReadSequenceNumber(99); context.setWriteSequenceNumber(99); handler.adjustTlsContextAfterSerialize(message); assertEquals(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS, context.getActiveClientKeySetType()); assertEquals(Tls13KeySetType.NONE, context.getActiveServerKeySetType()); assertArrayEquals(null, context.getLastClientVerifyData()); assertArrayEquals(null, context.getLastServerVerifyData()); assertEquals(0, context.getWriteSequenceNumber()); assertEquals(99, context.getReadSequenceNumber()); }
@Override public void adjustTlsContextAfterSerialize(FinishedMessage message) { if (tlsContext.getChooser().getSelectedProtocolVersion().isTLS13()) { if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) { setClientRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } else { adjustApplicationTrafficSecrets(); setServerRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } } }
FinishedHandler extends HandshakeMessageHandler<FinishedMessage> { @Override public void adjustTlsContextAfterSerialize(FinishedMessage message) { if (tlsContext.getChooser().getSelectedProtocolVersion().isTLS13()) { if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) { setClientRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } else { adjustApplicationTrafficSecrets(); setServerRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } } } }
FinishedHandler extends HandshakeMessageHandler<FinishedMessage> { @Override public void adjustTlsContextAfterSerialize(FinishedMessage message) { if (tlsContext.getChooser().getSelectedProtocolVersion().isTLS13()) { if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) { setClientRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } else { adjustApplicationTrafficSecrets(); setServerRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } } } FinishedHandler(TlsContext context); }
FinishedHandler extends HandshakeMessageHandler<FinishedMessage> { @Override public void adjustTlsContextAfterSerialize(FinishedMessage message) { if (tlsContext.getChooser().getSelectedProtocolVersion().isTLS13()) { if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) { setClientRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } else { adjustApplicationTrafficSecrets(); setServerRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } } } FinishedHandler(TlsContext context); @Override FinishedParser getParser(byte[] message, int pointer); @Override FinishedPreparator getPreparator(FinishedMessage message); @Override FinishedSerializer getSerializer(FinishedMessage message); @Override void adjustTLSContext(FinishedMessage message); @Override void adjustTlsContextAfterSerialize(FinishedMessage message); }
FinishedHandler extends HandshakeMessageHandler<FinishedMessage> { @Override public void adjustTlsContextAfterSerialize(FinishedMessage message) { if (tlsContext.getChooser().getSelectedProtocolVersion().isTLS13()) { if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) { setClientRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } else { adjustApplicationTrafficSecrets(); setServerRecordCipher(Tls13KeySetType.APPLICATION_TRAFFIC_SECRETS); } } } FinishedHandler(TlsContext context); @Override FinishedParser getParser(byte[] message, int pointer); @Override FinishedPreparator getPreparator(FinishedMessage message); @Override FinishedSerializer getSerializer(FinishedMessage message); @Override void adjustTLSContext(FinishedMessage message); @Override void adjustTlsContextAfterSerialize(FinishedMessage message);  }