Skip to content
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]How to use Chinese Key Vault #1126

Closed
sunmsy opened this issue Aug 6, 2019 · 7 comments
Closed

[QUESTION]How to use Chinese Key Vault #1126

sunmsy opened this issue Aug 6, 2019 · 7 comments
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. Question Used when a question is asked, as opposed to an issue being raised
Projects

Comments

@sunmsy
Copy link

sunmsy commented Aug 6, 2019

When I use the Chinese key vault, I get the following error
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: Invalid Azure Key Vault key path specified: https://sunmsy.vault.azure.cn/keys/test/d03f8000d80645cb9d26756e290d2076.
at com.microsoft.sqlserver.jdbc.SQLServerColumnEncryptionAzureKeyVaultProvider.ValidateNonEmptyAKVPath(SQLServerColumnEncryptionAzureKeyVaultProvider.java:456)
at com.microsoft.sqlserver.jdbc.SQLServerColumnEncryptionAzureKeyVaultProvider.encryptColumnEncryptionKey(SQLServerColumnEncryptionAzureKeyVaultProvider.java:287)
at com.sqlkeyvalut.demo.DemoApplication.createCEK(DemoApplication.java:148)
at com.sqlkeyvalut.demo.DemoApplication.testAKV(DemoApplication.java:99)
at com.sqlkeyvalut.demo.DemoApplication.main(DemoApplication.java:83)

@sunmsy sunmsy added the Question Used when a question is asked, as opposed to an issue being raised label Aug 6, 2019
@lilgreenbird
Copy link
Member

lilgreenbird commented Aug 6, 2019

hi @sunmsy

Please take a look at the documentation on Using Always Encrypted with the JDBC driver

You can also find an Azure Key Vault Sample here

If you are still having issues, please share your code with us so we can investigate further.

@lilgreenbird lilgreenbird added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Aug 6, 2019
@lilgreenbird
Copy link
Member

lilgreenbird commented Aug 6, 2019

The Azure key vault domain name is assumed to always end with "vault.azure.net" which is wrong for Azure China or other areas. Thanks for the report we will look into fixing this.

@sunmsy
Copy link
Author

sunmsy commented Aug 7, 2019

@lilgreenbird Thank you very much for your reply. If this bug is fixed, please let me know.

@lilgreenbird
Copy link
Member

We haven't set a timeout for the next release set, but typically this will likely be within the next couple of months. This issue will remain open until we publish the fix, if you subscribe to notifications you will be notified when the fix is merged. In the meantime, if you require a workaround sooner, you can clone the repo and customize this by removing the following lines from SQLServerColumnEncryptionAzureKeyVaultProvider.java:

451   // Check if it is pointing to AKV.
452   if (!parsedUri.getHost().toLowerCase(Locale.ENGLISH).endsWith(azureKeyVaultDomainName)) {
453       // Return an error indicating that the AKV url is invalid.
454       MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_AKVMasterKeyPathInvalid"));
455       Object[] msgArgs = {masterKeyPath};
456       throw new SQLServerException(null, form.format(msgArgs), null, 0, false);
457   }

@ulvii ulvii added this to Under Investigation in MSSQL JDBC Aug 9, 2019
@ulvii
Copy link
Contributor

ulvii commented Aug 15, 2019

Hi @sunmsy ,
We fixed the issue in #1130 . I also attached the jars below, would you give them a try and let us know if your issue is resolved?
PR1130.zip

@ulvii
Copy link
Contributor

ulvii commented Aug 23, 2019

Fixed in #1130

@ulvii ulvii closed this as completed Aug 23, 2019
MSSQL JDBC automation moved this from Under Investigation to Closed Issues Aug 23, 2019
@sunmsy
Copy link
Author

sunmsy commented Aug 26, 2019

Thanks, It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. Question Used when a question is asked, as opposed to an issue being raised
Projects
MSSQL JDBC
  
Closed Issues
Development

No branches or pull requests

3 participants