File tree 2 files changed +28
-0
lines changed
src/main/java/io/nats/client/impl
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1047,6 +1047,26 @@ The raw TLS test certs are in [src/test/resources/certs](src/test/resources/cert
1047
1047
> rm cert.p12 combined.pem
1048
1048
` ` `
1049
1049
1050
+ # ## TLS client versus server checks
1051
+
1052
+ When creating a connection, client TLS behavior is set while creating options.
1053
+ The client assumes TLS is requested if there is an SSLContext instance in the options.
1054
+ There are two ways one exists:
1055
+ 1. The user directly supplied one
1056
+ 2. A default one was created since one was not supplied, but a supplied server url has a secure protocol such as ` tls` , ` wss` or ` opentls`
1057
+
1058
+ If there is a mismatch, an IOException will be thrown during connect.
1059
+
1060
+ | server config | client options | result |
1061
+ | ---------------| -------------------| ----------------------------------------------|
1062
+ | required | tls not requested | mismatch, " SSL required by server." |
1063
+ | available | tls not requested | ok |
1064
+ | neither | tls not requested | ok |
1065
+ | required | tls requested | ok |
1066
+ | available | tls requested | ok |
1067
+ | neither | tls requested | mismatch, " SSL connection wanted by client." |
1068
+
1069
+
1050
1070
# ## TLS Handshake First
1051
1071
In Server 2.10.3 and later, there is the ability to have TLS Handshake First.
1052
1072
Original file line number Diff line number Diff line change @@ -681,6 +681,14 @@ void upgradeToSecureIfNeeded(NatsUri nuri) throws IOException {
681
681
dataPort .upgradeToSecure ();
682
682
}
683
683
else {
684
+ // server | client options | result
685
+ // --------- | ------------------- | --------
686
+ // required | not isTLSRequired() | mismatch
687
+ // available | not isTLSRequired() | ok
688
+ // neither | not isTLSRequired() | ok
689
+ // required | isTLSRequired() | ok
690
+ // available | isTLSRequired() | ok
691
+ // neither | isTLSRequired() | mismatch
684
692
ServerInfo serverInfo = getInfo ();
685
693
if (options .isTLSRequired ()) {
686
694
if (!serverInfo .isTLSRequired () && !serverInfo .isTLSAvailable ()) {
You can’t perform that action at this time.
0 commit comments