Display data from an AlwaysEncrypted column in a NodeJS app?

跟風遠走 提交于 2021-02-10 06:26:27

问题


I have a SQL Server database in Azure that is accessed by a .NET app and by a NodeJS app. I just applied AlwaysEncrypted to a table column that contains sensitive information. I used Azure Key Vault to store the encryption key.

I was wondering if it is possible to display the (decrypted) data in my NodeJS app?

A workaround to this would be to expose the data that I want to query through an API endpoint in my .NET app, and then call that endpoint from my NodeJS app, but I'm looking for a more elegant way of doing it.


回答1:


Based on my understanding, I think the more elegant way you said is that directly using JavaScript to decrypte data for column applied Always Encrypted.

I can't find any code for doing it directly. However, I think there are two ways which you can try.

  1. According the offical document Using Always Encrypted with the JDBC Driver, you can try to use the node package node-java to bridge an API that using Java to query encrypted column data. Please node the content below.

Always Encrypted is supported only by Microsoft JDBC Driver 6.0 (Preview) or higher for SQL Server with SQL Server 2016 (Preview).

  1. There is a document Always Encrypted Cryptography describes encryption algorithms and mechanisms to derive cryptographic material used in the Always Encrypted feature in SQL Server and Azure SQL Database. It seems that you can try to decrypt the encrypted data via perform the reverse process of data encryption algorithm with some node packages like crypto-js, bcrypt, etc.

Hope it helps.



来源:https://stackoverflow.com/questions/37066987/display-data-from-an-alwaysencrypted-column-in-a-nodejs-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!