SQL Server CLR集成实现加解密

发布于 2024-10-10 22:43:34 字数 558 浏览 0 评论 0原文

我需要将数据以加密形式存储在数据库表中。我想在数据库级别执行此操作,但这是我面临的问题:

  1. 字段的数据类型应该是 Varbinary。
  2. 工作组版不支持加密
  3. 是否可以加密数字字段?

我想访问表中的加密数据以获取视图和存储过程以进行某些处理,但由于上述问题我无法这样做。

这是我的环境:

开发平台 - ASP.Net、.Net Framework 3.5、Visual studio 2008

服务器操作系统 - Windows Server 2008

数据库 - SQL Server 2008工作组版

我也在考虑采用不同的方法来解决这个问题(尚未测试其可行性)。我只是想知道是否可以创建一个 CLR 函数(它可以使用 .Net 框架中提供的加密类型使用参数来加密和解密数据)并使用 SQL Server 的 CLR 集成功能并从存储过程和视图调用该函数。

我不确定我的思考方向是否正确?对此还有什么建议吗?

I have a requirement to store the data in encrypted form in database tables. I want to do it at the database level but here are the problems I am facing:

  1. Data Type of the field should be Varbinary.
  2. Encryption is not supported by Workgroup edition
  3. Is it possible to encrypt Numeric Fields?

I want to access the encrypted data in tables to fetch in views and stored procedure for some processing but due to above problems I am not able to.

Here is my Environment:

Development Platform - ASP.Net,.Net Framework 3.5,Visual studio 2008

Server Operating System - Windows Server 2008

Database - SQL Server 2008 Work group edition

I was also thinking to adopt a different approach to resolve this issue (yet to test it's feasibility). I was just wondering if I could create a CLR function (which could take parameters to encrypt and decrypt data using Cryptography types provided in .Net framework) and use the CLR integration feature of SQL Server and call that function from stored procedure and views.

I am not sure if I am thinking in right direction? Any advice on this as well please.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花似海 2024-10-17 22:43:34

是的,你可以这样做。但是,您的 SQL CLR 程序集可能需要标记为不安全,加密类才能正常工作,具体取决于您使用的 cryptoapi 方法。

Yes, you can do that. However, your SQL CLR assembly may need to be marked as unsafe for the crypto classes to work, depending on what cryptoapi methods you use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文