在sql server上实现一些加密算法

发布于 2024-12-06 15:21:53 字数 116 浏览 1 评论 0原文

我们可以编写一个用户定义的函数来根据sql server 2000中的密钥加密文本字符串吗?例如,我想尝试编写三重 DES 算法来加密文本。为此如何编写语句?我在网上查了一下;我一开始就无法理解密码学的语言......

Can we write a user defined function to encrypt a string of text based on a key in sql server 2000? For e.g. I want to try writing a triple DES algorithm to encrypt text. How to write statements for this? I checked around the internet; I can't understand the language of cryptography to begin with...

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

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

发布评论

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

评论(2

娇女薄笑 2024-12-13 15:21:53

考虑升级到 SQL Server 2005 或更高版本,其中包括许多加密功能。它们使这一切变得简单:

  1. 创建一个证书来管理您的密钥 (CREATE CERTIFICATE)
  2. 从密码创建加密密钥 (CREATE SYMMETRIC KEY)
  3. 将加密数据写入表 (>ENCRYPTBYKEY())
  4. 从表中读取解密数据 (DECRYPTBYKEY())

dotnetslackers.com 有一个 易于阅读的基础知识指南

如果您绝对必须坚持使用 SQL Server 2000,那么您应该强烈考虑使用第三方加密包,因为从头开始编写 3DES 并非易事。 Application Security 曾经推出过一款名为“DbEncrypt”的产品,但我不知道它是否是仍然可用。

Consider upgrading to SQL Server 2005 or higher, which includes numerous encryption functions. They make it easy:

  1. Create a certificate to manage your key (CREATE CERTIFICATE)
  2. Create an encryption key from a password (CREATE SYMMETRIC KEY)
  3. Write encrypted data to table (ENCRYPTBYKEY())
  4. Read decrypted data from table (DECRYPTBYKEY())

dotnetslackers.com has an easy-to-read howto on the basics.

If you absolutely must stick with SQL Server 2000, you should strongly consider a third-party package for encryption, as writing 3DES from scratch is no small task. Application Security used to put out a product called 'DbEncrypt', but I don't know if it's still available.

余生再见 2024-12-13 15:21:53

I just found this article --> http://www.sqlservercentral.com/articles/Security/freeencryption/1980/. Seems you can do this via extended stored procedures. There are some 3rd party dlls which allow you to do this. There is a link to download the dlls (zipped) from the site. You have to add this to your sql server's binn folder, and call some scripts to add it to the extended stored procedures list. I not sure if this will work for sql server which runs of 64-bit machines.

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