如何在asp.net中的sql databse中以加密格式保存密码 [英] How to save password in encrypted format in sql databse in asp.net

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

问题描述

我想以加密格式将密码保存在sql数据库中.
请帮助.....

I want to save my password in Encrypted format in sql database.
pls help.....

推荐答案

请参阅此类似线程
如何以加密形式在sql中插入密码 [ ^ ]
Refer this similar thread
how to insert password in sql in encrypted form[^]




这是解决方案

您可以使用EncryptByPassPhrase函数对密码进行加密,也可以将密码作为VarBinary存储在列中.可以使用DECRYPTBYPASSPHRASE函数对加密的列进行解密.

现在,将密码字段插入表中

插入到login_details(uid,username,password)VALUES(1,``smith'',EncryptByPassPhrase(''12'',``XXX''))

它将以加密格式将值插入数据库,同时解密将相同的加密值传递给DECRYPTBYPASSPHRASE函数

谢谢,
流行
Hi,

Here is the solution

You can encrypt a password and can store a password as VarBinary in a column by using EncryptByPassPhrase function. Encrypted column can be decrypted using the DECRYPTBYPASSPHRASE function.

Now while inserting the password filed into the table

INSERT INTO login_details(uid,username,password) VALUES(1,''smith'',EncryptByPassPhrase(''12'',''XXX''))

It will insert the value into the DB in encrypted format,while decription pass the same encripted value into the DECRYPTBYPASSPHRASE function

Thanks,
Prasant


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

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