-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Connection Error: Internal error during decryption: Tag mismatch! #1939
Comments
Hi @AndrzejHeller, We're changing the title to help us find the issue later. I see you've added TLS1.2 to the connection string, can you try with TLS1 ( |
Hello @Jeffery-Wasty , openjdk version "11.0.9.1" 2020-11-04 LTS and openjdk version "11.0.9" 2020-10-20 We use Adopt, Corretto and Oracle Java in our test environments, I think it’s a coincidence that I didn’t find any failures for Oracle Java. |
Thanks for testing TLSv1, and the versions for your JDK. I see why you added to the connection string but adding Has the problem been the same throughout the connection string changes? That is, do you have the error with |
Are you using the |
When I observed the issue for the very first time, my connection string was like this: |
I've never tried providing |
@Jeffery-Wasty , |
@AndrzejHeller So the |
Please try |
@Jeffery-Wasty |
Hey @AndrzejHeller, I believe there is a race condition in our password obfuscation code. I've attached a driver jar with the fix. Could you test it out and see if it corrects your problem? Thanks. |
Hello @tkyc , |
@tkyc ,
I can provide a full log if necessary. |
@AndrzejHeller that'd be great if you can provide the logs. If possible, could you also provide a standalone reproduction app? I'll need to investigate again. For sure there was a race condition. Interesting that it doesn't seem to be the cause of your problem. Whatever the case, there is definitely something suspect in our password obfuscation code. |
@tkyc , Unfortunately, I can't provide any application that may help you reproducing the problem. |
@AndrzejHeller no worries. I'll see what I can figure out. I'll keep you posted. |
Hey @AndrzejHeller, I've attached another driver jar with an attempted fix. Please let me know if it resolves your problem. |
Hello @tkyc , |
@AndrzejHeller sounds good, thanks for the help on testing. The fix will be included in a hotfix release for version 11.2.2. I don't have a date for the hotfix release yet as the team is still discussing other things that will be included in the hotfix. I'll update this thread with the date when we have a definite schedule. |
We just released a hotfix with this fix. It can be found in v11.2.2 of the driver. |
Question
I randomly experience connection failures when trying to establish secure connection to MS SQL Server instance running in AWS environment. Initially, my connection string was like this:
jdbc:sqlserver://:1433;databaseName=;trustServerCertificate=false
In my first attempt to resolve the problem, I’ve changed it to be like this:
jdbc:sqlserver://:1433;encrypt=true;trustServerCertificate=false;databaseName=
I’m not sure if parameter order makes any difference or it is necessary to set ‘encrypt’ explicitly. I did my changes to make the connection string to be as similar as possible to examples that can be found in Microsoft’s online documentation. Additionally, I’ve found this issue:
It’s marked as resolved, but I still implemented my changes to be on the safe side. Unfortunately, all connection string modifications didn’t make any difference. Following that, I made further changes to my connection string to make it like this:
jdbc:sqlserver://:1433;encrypt=true;trustServerCertificate=false;sslProtocol=TLSv1.2;databaseName=
Unfortunately, the problem is still there. The following exception is thrown each time connection attempt fails:
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Internal error during decryption: Tag mismatch! ". ClientConnectionId:8e8c7663-6299-4a05-8168-e67b1588444d
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3806)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1906)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3329)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:1385)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(SQLServerDataSource.java:97)
at asi.utility.DbMgr.makeConnection(DbMgr.java:58)
at asi.edms.data.DataDocSearch.getPhysicalPath(DataDocSearch.java:768)
at asi.edms.data.DataMgr.getPhysicalName(DataMgr.java:1889)
at asi.edmsapi.EdmsFileManager.getPhysicalName(EdmsFileManager.java:1532)
at com.pb.engageone.server.batch.na.tdsextract.core.repository.oe.RepositoryImpl.getFilePath(RepositoryImpl.java:61)
at com.pb.engageone.server.batch.na.tdsextract.api.RepositoryApi.getTemplateInformation(RepositoryApi.java:90)
at com.pb.engageone.server.batch.na.tdsextract.api.RepositoryApi.getTemplateInformation(RepositoryApi.java:199)
at com.pb.engageone.server.batch.na.dao.CachingTemplateDaoEjb.retrieveTemplate(CachingTemplateDaoEjb.java:46)
at com.pb.engageone.server.batch.na.dao.CachingTemplateDaoEjb.retrieveTemplate(CachingTemplateDaoEjb.java:32)
at com.pb.engageone.server.batch.na.gather.processor.BatchItemPreProcessor.process(BatchItemPreProcessor.java:305)
at com.pb.engageone.server.batch.na.gather.processor.CompositeBatchItemProcessor.process(CompositeBatchItemProcessor.java:28)
at com.pb.engageone.server.batch.na.gather.processor.BatchItemProcessorWorker.work(BatchItemProcessorWorker.java:79)
at com.pb.engageone.server.batch.na.ThreadManager$WorkerThread.run(ThreadManager.java:214)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Internal error during decryption: Tag mismatch!
at com.microsoft.sqlserver.jdbc.SecureStringUtil.getDecryptedChars(SecureStringUtil.java:146)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1695)
... 19 common frames omitted
All my tests have been performed using the latest mssql-jdbc-11.2.1.jre11.jar file. Similar problem is observed with mssql-jdbc-11.2.0.jre11.jar, but it looks the problem is gone if I downgrade to mssql-jdbc-10.2.1.jre11.jar. I’m now wondering if my connection string is wrong (something is missing?) or maybe I’m suffering from a bug that’s only present from version 11.2.0 onwards.
Can someone help with that?
Regards,
Andrzej
Relevant Issues and Pull Requests
#1853
#879
The text was updated successfully, but these errors were encountered: