Skip to content

Commit f1e2937

Browse files
committed
Report extension type in unsupported_extension error messages
1 parent 8f1b358 commit f1e2937

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tls/src/main/java/org/bouncycastle/tls/DTLSClientProtocol.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,8 @@ protected void processServerHello(ClientHandshakeState state, byte[] body)
877877
*/
878878
if (null == TlsUtils.getExtensionData(state.clientExtensions, extType))
879879
{
880-
throw new TlsFatalAlert(AlertDescription.unsupported_extension);
880+
throw new TlsFatalAlert(AlertDescription.unsupported_extension,
881+
"Unrequested extension in ServerHello: " + ExtensionType.getText(extType.intValue()));
881882
}
882883

883884
/*

tls/src/main/java/org/bouncycastle/tls/TlsClientProtocol.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ protected void process13HelloRetryRequest(ServerHello helloRetryRequest)
869869
if (null == TlsUtils.getExtensionData(clientExtensions, extType))
870870
{
871871
throw new TlsFatalAlert(AlertDescription.unsupported_extension,
872-
"received unrequested extension response: " + ExtensionType.getText(extensionType));
872+
"Unrequested extension in HelloRetryRequest: " + ExtensionType.getText(extensionType));
873873
}
874874
}
875875
}
@@ -1529,7 +1529,8 @@ protected void receive13EncryptedExtensions(ByteArrayInputStream buf)
15291529

15301530
if (null == TlsUtils.getExtensionData(clientExtensions, extType))
15311531
{
1532-
throw new TlsFatalAlert(AlertDescription.unsupported_extension);
1532+
throw new TlsFatalAlert(AlertDescription.unsupported_extension,
1533+
"Unrequested extension in EncryptedExtensions: " + ExtensionType.getText(extType.intValue()));
15331534
}
15341535
}
15351536
}

0 commit comments

Comments
 (0)