public PostTransactionResponse PostTransaction(PostTransactionRequest 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(requestData.PayLoad.ReferenceID, requestData.Credentials.Username, DateTime.Now, "POSTING", "", e.Message, ""); } if (String.IsNullOrEmpty(strCert)) { password = ""; } else { password = strCert; } dh.SaveRequestlog(requestData.PayLoad.ReferenceID, requestData.Credentials.Username, requestData.PayLoad.Amount, password, "POSTING", DateTime.Now); PostTransactionResponse resp = new PostTransactionResponse(); try { if (requestData.IsValidRequest()) { resp = bll.PostTransaction(requestData); } else { resp.Status = new Status(); resp.Status.StatusCode = "200"; resp.Status.Description = "Successful"; resp.PayLoad.StatusCode = requestData.PegPayStatusCode; resp.PayLoad.Description = requestData.PegPayStatusDescription; } } catch (Exception e) { requestData.PegPayStatusCode = "101"; requestData.PegPayStatusDescription = "GENERAL ERROR AT PEGASUS"; resp.Status.StatusCode = requestData.PegPayStatusCode; resp.Status.Description = requestData.PegPayStatusDescription; } return(resp); }