/// <summary> /// 验证主账号密码 /// </summary> /// <param name="password">主账号密码</param> /// <returns></returns> public bool VerifyAccountPwd(string password) { string passWordCertificate = CurPassWordBookModel.Account + password; if (CurPassWordBookModel.IsComputer) { string computer = getComputer(); computer = IEncryptAndDecodeServer.GetSha1(computer); passWordCertificate = IEncryptAndDecodeServer.GetHMacSha512(passWordCertificate, computer); } else { passWordCertificate = IEncryptAndDecodeServer.GetSha512(passWordCertificate); } passWordCertificate = IEncryptAndDecodeServer.GetMd532(passWordCertificate); if (passWordCertificate.Equals(CurPassWordBookModel.PassWordCertificate)) { //生成加密认证的密保 GetPassWordSecurity(password); return(true); } else { return(false); } }
/// <summary> /// 生成密码凭证 /// </summary> /// <param name="isComputer">是否计算机加密</param> /// <param name="account">账号</param> /// <param name="passWord">密码</param> private string GetPassWordCertificate(string account, string passWord, bool isComputer) { string passWordCertificate = string.Empty; if (isComputer)//需要机器码 { string computerInfo = getComputer(); string sha1 = IEncryptAndDecodeServer.GetSha1(computerInfo); passWordCertificate = IEncryptAndDecodeServer.GetHMacSha512(account + passWord, sha1); } else { passWordCertificate = IEncryptAndDecodeServer.GetSha512(account + passWord); } return(IEncryptAndDecodeServer.GetMd532(passWordCertificate)); }