我在我的应用程序中使用凭据选择器进行用户身份验证。我的数据库中的身份验证详细信息采用字符串格式。但是凭据选择器传递的密码是加密形式的(默认情况下协商身份验证协议),所以如何解密该密码以便我可以匹配我的数据库密码。与数据库存储密码进行密码匹配的最佳和正确解决方案是什么?下面是代码片段:
function launchCredentialPicker() {
Windows.Security.Credentials.UI.CredentialPicker.pickAsync("My Target", "My Message", "my Caption").then(function (results) {
var domainName = results.credentialDomainName;
WinJS.Application.sessionState.Username = results.credentialUserName;
WinJS.Application.sessionState.Password = results.credentialPassword;
WinJS.Application.sessionState.RememberPassword = (results.credentialSaveOption === Windows.Security.Credentials.UI.CredentialSaveOption.hidden) ? "Hidden" :
((results.credentialSaveOption === Windows.Security.Credentials.UI.CredentialSaveOption.selected) ? "Selected" : "Unselected");
});
}