/// <summary> /// 修改签名密码 /// </summary> private bool ChangeSignedPassword() { bool returnValue = false; // 1:这里判断签名文件中的签名密码是否正确? string privateKey = string.Empty; string signedPassword = string.Empty; try { signedPassword = SecretUtil.GetSignedPassword(txtDigitalSignature.Text); if (!signedPassword.Equals(SecretUtil.md5(this.txtOldPassword.Text, 32))) { MessageBox.Show(AppMessage.Format(AppMessage.MSG0040, AppMessage.MSG9961), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtOldPassword.Focus(); this.txtOldPassword.SelectAll(); return(false); } // 2:同时可以把私钥读取出来。 privateKey = SecretUtil.GetPrivateKey(this.txtDigitalSignature.Text, this.txtOldPassword.Text); } catch { MessageBox.Show("修改签名密码失败、请重修改签名密码。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } // 3:判断服务器上的签名密码是否正确? string statusCode = string.Empty; string statusMessage = string.Empty; DotNetService.Instance.LogOnService.ChangeSignedPassword(UserInfo, this.txtOldPassword.Text, this.txtNewPassword.Text, out statusCode, out statusMessage); if (statusCode == StatusCode.ChangePasswordOK.ToString()) { // 4:保存签名密钥 this.SaveDigitalSignature(privateKey, this.txtNewPassword.Text); // 修改数字签名后的方法 if (AfterChangeDigitalSignature != null) { AfterChangeDigitalSignature(this.UserInfo.Id); } else { if (BaseSystemInfo.ShowInformation) { // 提示修改成功 MessageBox.Show("修改签名密码成功、请妥善保管好签名密钥文件。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); } } this.DialogResult = DialogResult.OK; returnValue = true; } else { if (statusCode == StatusCode.PasswordCanNotBeNull.ToString()) { this.ClearOldPassword(); } if (statusCode == StatusCode.OldPasswordError.ToString()) { this.ClearOldPassword(); } MessageBox.Show(statusMessage, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); returnValue = false; } return(returnValue); }