diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java index 69d9e1c56..9804184a9 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java @@ -1826,6 +1826,16 @@ else if (con.getTrustManagerClass() != null) { // SSL is now enabled; switch over the channel socket channelSocket = sslSocket; + // Check the TLS version + String tlsProtocol = sslSocket.getSession().getProtocol(); + if (SSLProtocol.TLS_V10.toString().equalsIgnoreCase(tlsProtocol) + || SSLProtocol.TLS_V11.toString().equalsIgnoreCase(tlsProtocol)) { + String warningMsg = tlsProtocol + + " was negotiated. Please update server and client to use TLSv1.2 at minimum."; + logger.warning(warningMsg); + con.addWarning(warningMsg); + } + if (logger.isLoggable(Level.FINER)) logger.finer(toString() + " SSL enabled"); } catch (Exception e) { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java index 3973bfc83..22805cc6f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java @@ -3572,7 +3572,7 @@ public SQLWarning getWarnings() throws SQLServerException { } // Any changes to SQLWarnings should be synchronized. - private void addWarning(String warningString) { + void addWarning(String warningString) { synchronized (warningSynchronization) { SQLWarning warning = new SQLWarning(warningString);