如何以加密形式在sql中插入密码 [英] how to insert password in sql in encrypted form

查看:120
本文介绍了如何以加密形式在sql中插入密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以加密形式将密码保存在数据库中...

i want to save the password in the database in encrypt form......

推荐答案

请参见此处:

请参考以下主题:
如何进行加密和解密使用C#在asp.net中输入密码? [在数据库中存储密码的最佳方法 [带有加密的用户输入 [ ^ ]
在sqlite数据库中加密登录名和密码 [ ^ ]
Please refer following threads:
How to encrypt and decrypt password in asp.net using C#?[^]

Refer some similar discussions:
Best way to store password in database[^]
User Input With Encryption[^]
Encrypt login and password in sqlite database [^]


步骤1:
创建一个SQLCLR UDF,如以下示例所示:

公共字符串cryptoString(string s,字符串密钥){}

http://msdn.microsoft.com/en-us/library/w2kae45k%28v = vs.80%29.aspx

第2步:
您可以像示例中那样实现加密逻辑

http://msdn.microsoft.com/en-us/library/system. security.cryptography.rijndaelmanaged.aspx

第3步:
将加密密钥主要存储在应用程序配置文件中,以遵循最佳做法.

第4步:
在数据库中注册UDF.

第5步:
您应该能够在应用程序代码中或在数据库代码中将 encyptionString 实现方法用作UDF.

穴居人| http://cavemansblog.wordpress.com
Step 1:
Create a SQLCLR UDF like in this example:

public string encryptString(string s, string key){}

http://msdn.microsoft.com/en-us/library/w2kae45k%28v=vs.80%29.aspx

Step 2:
You could implement encryption logic like in the example

http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx

Step 3:
Store the encryption key in you application config file mostly to follow best practices.

Step 4:
Register the UDF with your database.

Step 5:
You should be able to use the encyptionString implementation as a method in you application code or in your DB code as a UDF.

Caveman | http://cavemansblog.wordpress.com


这篇关于如何以加密形式在sql中插入密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆