public ValidateCustomerResponse ValidateCustomer(ValidateCustomerRequest requestData) { string strCert = null; //Hashing the password try { string text = requestData.Credentials.Password; string certificate = @"E:\Certs\pegasus.pfx"; X509Certificate2 cert = new X509Certificate2(certificate, "Tingate710", X509KeyStorageFlags.UserKeySet); RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PrivateKey; // Hash the data SHA1Managed sha1 = new SHA1Managed(); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] data = encoding.GetBytes(text); byte[] hash = sha1.ComputeHash(data); // Sign the hash byte[] digitalCert = rsa.SignHash(hash, CryptoConfig.MapNameToOID("SHA1")); strCert = Convert.ToBase64String(digitalCert); } catch (Exception e) { dh.LogErrorKCB("", "", DateTime.Now, "", "", e.Message, ""); } if (String.IsNullOrEmpty(strCert)) { password = ""; } else { password = strCert; } dh.SaveRequestlog("", requestData.Credentials.Username, "", password, "VALIDATION", DateTime.Now); ValidateCustomerResponse resp = new ValidateCustomerResponse(); try { if (requestData.IsValidRequest()) { resp = bll.QueryCustomerDetails(requestData); } else { resp.Details.Status.StatusCode = "200"; resp.Details.Status.Description = "Successful"; resp.Details.Resultz.StatusCode = requestData.PegPayStatusCode; resp.Details.Resultz.StatusDescription = requestData.PegPayStatusDescription; } } catch (Exception e) { requestData.PegPayStatusCode = "200"; requestData.PegPayStatusDescription = "Successful"; resp.Details.Status.StatusCode = "100"; resp.Details.Status.Description = "UNABLE TO VERIFY CUSTOMER REFERENCE AT THE MOMENT"; // dh.LogError("SendPendingTransactionsToUtility TranId: " + tran.VendorTranId + " : " + e.Message, tran.VendorCode, DateTime.Now, tran.UtilityCompany); } return(resp); }