Tag: 密码

如何使用ASP.NET Identity Framework设置密码到期

我有一个使用Identity的ASP.NET项目。 对于有关密码的身份配置,正在使用PasswordValidator 。 如何扩展PasswordValidator当前的密码强制执行( RequiredLength , RequiredDigit等)以满足在N天后要求密码过期的要求?

指定的填充模式对此算法无效 – c# – System.Security.Cryptography

对c#来说很新,目前在解密长密码时遇到问题,错误是 指定的密钥不是此算法的有效大小 我知道这与加密密码位长度不受支持有关,但不确定如何建议允许这些更长密码的方法。 这是我的加密和解密 “cipherKey”:“0123456789abcdef”,“cipherVector”:“somereallycooliv” using System; using System.Security.Cryptography; using System.IO; using System.Text; namespace DataApi { public class Encryption { private readonly IConfigurationService _configService; private const string _vector = “cipherVector”; private const string _key = “cipherKey”; public Encryption(IConfigurationService configService) { _configService = configService; } public string EncryptString(string text) { if(string.IsNullOrEmpty(text)) { return “”; } try […]

如何在C#应用程序中安全地存储数据库登录名和密码?

我有一个C#应用程序需要连接到SQL数据库以不时发送一些数据。 如何安全地存储用于此作业的用户名和密码?

哪种算法首选散列密码C#?

可能重复: 我应该使用什么算法将密码哈希到我的数据库中? 我是密码新手。 我读了哈希+盐使密码真的很安全。 但仍然困惑我应该使用哪种哈希算法,因为有很多像。 MD5CryptoServiceProvider SHA1Managed SHA256Managed等 我怎样才能决定哪一个对我有利或者一切都是平等的。 我可以盲目接受任何人吗?

检查字符串是否有足够强的密码

可能重复: 强密码正则表达式 需要RegEx来获得密码强度吗? 我只是想知道在某些条件下搜索字符串的最佳方法是什么(具体的密码强度)可以实现。 到目前为止,我有一个简单的: if(password.Length <= 7) { errorMessage = "Your password must be at least 8 characters."; } 我希望能够检查大写字母,但我不确定方法或程序是什么。 我试过谷歌搜索网站: http : //msdn.microsoft.com ,搜索我的C#书的索引(C#编程3E,芭芭拉道尔),但我似乎找不到任何东西。 我知道我可以试试这个……: foreach(char c in password) { if(c!=’A’ || c!=’B’ || c!=’C’ || c!=’D’ ….. || c!=’Z’) { errorMessage = “Your password must contain at least one capital letter”; } […]

如何在WPF中的密码框中将插入位置设置为特定索引

我需要在WPF中显式设置密码框内的cursorposition。 我在passwordbox中看不到selectionstart属性。 有帮助吗?

Caliburn.Micro对PasswordBox的支持?

http://caliburnmicro.com上的Caliburn.Micro主页提出了下面的声明,但是我无法使用我在这个例子中可以想到的任何变体使用CMBox控件。 不知道这怎么会起作用,因为名字不是同一个案例。 有没有人有CM示例允许我获得PasswordBox的值? 是否需要特定版本的CM? 我正在运行CM的1.5.2版本。 理想情况下不使用附加属性,但如果可以使用CM,那么唯一的方法就好了。 请不要就安全问题讲课,因为这不是我的问题。 使用参数和保护方法自动在视图和视图模型之间应用方法 public bool CanLogin(string username, string password) { return !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password); } public string Login(string username, string password) { … }

寻找c#等效的php的密码 – validation()

我需要将一堆用户帐户Moodle导入到用c#编写的系统中。 Moodle使用password_hash()函数创建密码哈希值。 我需要能够在c#中validation这些密码。 换句话说,我正在寻找PHP的密码validationfunction的ac#实现( http://www.php.net/manual/en/function.password-verify.php )。 我用谷歌搜索了一下但是真的找不到任何东西,所以我要求避免重新发明轮子:-) 谢谢!

这是在Db中加密和存储密码的方法吗?

有几种方式(即使在这里也是如此)并且他们都提到在数据库上保存密码的最佳方法是保存密码,而不是密码,而是存储盐渍密码的哈希值 。 我的问题很简单,把一些代码放在上面,这是正确的方法吗? string username = “myUsr”; string password = “myPwd”; DateTime createDate = DateTime.UtcNow; // Salt it string saltedPwd = String.Concat(password, createDate.Ticks.ToString()); // Hash it HMACSHA1 hash = new HMACSHA1(Encoding.Unicode.GetBytes(Helper.EncryptKey)); string encodedPwd = Convert.ToBase64String( hash.ComputeHash(Encoding.Unicode.GetBytes(saltedPwd))); // Create User in the database db.CreateUser(username, encodedPwd, createDate); 数据库用户表 user_id | username | password | create_date | last_access […]

WebMatrix WebSecurity PasswordSalt

我正在使用WebMatrix,并建立了一个基于“StarterSite”的网站。 在这个初学者网站中,您将获得一个很好的基本布局 – 包括注册,登录,忘记密码页等… 我注意到在数据库中“webpages_Membership”表有一个名为“PasswordSalt”的列。 创建一些新用户帐户后,此列始终为空。 所以我假设没有使用密码盐(甚至不是默认密码)。 显然这不是最佳实践,但我似乎找不到任何文档告诉我如何设置或管理密码盐。 如何使用WebSecurity Helper设置密码salt?