Server abbreviated handshake messages
@@ -724,7 +724,7 @@ protected void handle13HandshakeMessage(short type, HandshakeMessageInput buf)
throw new TlsFatalAlert(AlertDescription.internal_error);
}
- if (this.resumedSession)
+ if (resumedSession)
{
/*
* TODO[tls13] Abbreviated handshakes (PSK resumption)
@@ -869,10 +869,18 @@ protected void handleHandshakeMessage(short type, HandshakeMessageInput buf)
throw new TlsFatalAlert(AlertDescription.internal_error);
}
- if (this.resumedSession)
+ if (resumedSession)
{
- // TODO Abbreviated handshakes for legacy TLS (session resumption)
- throw new TlsFatalAlert(AlertDescription.internal_error);
+ if (type != HandshakeType.finished || this.connection_state != CS_SERVER_FINISHED)
+ {
+ throw new TlsFatalAlert(AlertDescription.unexpected_message);
+ }
+
+ processFinishedMessage(buf);
+ this.connection_state = CS_CLIENT_FINISHED;
+
+ completeHandshake();
+ return;
}
switch (type)
@@ -926,6 +934,14 @@ protected void handleHandshakeMessage(short type, HandshakeMessageInput buf)
sendServerHelloMessage(serverHello);
this.connection_state = CS_SERVER_HELLO;
+ if (resumedSession)
+ {
+ sendChangeCipherSpec();
+ sendFinishedMessage();
+ this.connection_state = CS_SERVER_FINISHED;
+ break;
+ }
+
Vector serverSupplementalData = tlsServer.getServerSupplementalData();
if (serverSupplementalData != null)
{
