-
Notifications
You must be signed in to change notification settings - Fork 435
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
Feature | client certificate authentication #1284
Conversation
…ed by default (microsoft#1254) * skip AKV test properly * removed enclave properties string to failed errors as enclave tests could be skipped
Add support for PKCS8 and PKCS1 private keys
… into clientcertauth
change logic for decryptprovider
Fix pkcs8 and add tests
… into clientcertauth # Conflicts: # src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Clientcertauth
+ ";"; | ||
try (Connection conn = DriverManager.getConnection(conStr)) { | ||
} catch (SQLServerException e) { | ||
assertTrue(e.getMessage().contains(TestResource.getResource("R_invalidPath"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use R_clientCertError
from SQLServerResource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQLServerResource is not visible in this package, we can just use the TestResource for test related texts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See SQLServerConnectionTest.executeInvalidFmt() for example use.
assertTrue(e.getMessage().matches(TestUtils.formatErrorMsg("R_invalidArgument")));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. done.
src/test/java/com/microsoft/sqlserver/clientcertauth/ClientCertificateAuthenticationTest.java
Outdated
Show resolved
Hide resolved
|
||
@Test | ||
public void testDataSource() throws Exception { | ||
String conStr = connectionString + ";clientCertificate=" + clientCertificate + ".pem;" + "clientKey=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't you using new DataSource APIs? setClientCertificate(), setClientKey(), setClientKeyPassword
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/test/java/com/microsoft/sqlserver/clientcertauth/ClientCertificateAuthenticationTest.java
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/clientcertauth/ClientCertificateAuthenticationTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/clientcertauth/ClientCertificateAuthenticationTest.java
Outdated
Show resolved
Hide resolved
String match provider name
The JDBC driver will add three connection properties for this feature:
clientCertificate – specifies the certificate to be used for authentication. The JDBC driver will support PFX, PEM, DER and CER file extensions. Format:
• clientCertificate=<file_location>
The driver uses a certificate file. For certificates in PEM, DER and CER formats clientKey attribute is required.
clientKey – specifies a file location of the private key for PEM, DER and CER certificates specified by the clientCertificate attribute. Format:
• clientKey=<file_location>
Specifies location of the private key file. In case if private key file is password protected then password keyword is required.
clientKeyPassword – optional password string provided to access the clientKey file’s private key.