private PaymentInstructions SetMedicalVendorPaymentInstructions(PaymentInstructions instructions) { if (instructions == null) { instructions = new PaymentInstructions(); } instructions.AccountHolderName = txtAccountHolder.Text; instructions.AccountNumber = txtAccountNo.Text; if (ddlAccountType.SelectedIndex > 0) { instructions.AccountType = (AccountType)Convert.ToInt32(ddlAccountType.SelectedValue); } instructions.BankName = txtBankName.Text; if (ddlInterval.SelectedIndex > 0) { instructions.Interval = (PaymentFrequency)Convert.ToInt32(ddlInterval.SelectedValue); } instructions.Memo = txtMemo.Text; if (ddlPayMode.SelectedIndex > 0) { instructions.PaymentMode = (VendorPaymentMode)Convert.ToInt32(ddlPayMode.SelectedValue); } instructions.RoutingNumber = txtRoutingNumber.Text; instructions.SpecialInsructions = txtSplInstruction.Text; return(instructions); }
public PaymentInstructions Save(PaymentInstructions paymentInstruction) { using (var myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var entity = _mapper.Map(paymentInstruction); if (!myAdapter.SaveEntity(entity, true)) { throw new PersistenceFailureException(); } paymentInstruction.Id = entity.PaymentInstructionId; } return(paymentInstruction); }
static void Main(string[] args) { X509Certificate2 customerCertificate, merchantCertificate, gatewayCertificate; string customerPrivateKey, merchantPublicKey, gatewayPublicKey; bool verify; Common c = new Common(); IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(iep); //tạo init request gửi tới merchant InitiateRequest initiateRequest = new InitiateRequest(); c.send(initiateRequest.ToMessage(), client); //nhận init response từ merchant string receiveMessage = c.receive(client); string[] initRES = receiveMessage.Split('-'); merchantCertificate = new X509Certificate2(c.StringToByteArray(initRES[2])); gatewayCertificate = new X509Certificate2(c.StringToByteArray(initRES[3])); merchantPublicKey = merchantCertificate.GetRSAPublicKey().ToXmlString(false); gatewayPublicKey = gatewayCertificate.GetRSAPublicKey().ToXmlString(false); verify = c.Verify(merchantPublicKey, initRES[1], initRES[0]); Console.WriteLine("verify init response: " + verify); //tạo purchase request string[] value = File.ReadAllLines("d:/file/input.txt"); string[] initREQValue = initRES[0].Split(':'); InitiateResponse initiateResponse = new InitiateResponse(initREQValue[0], initREQValue[1], initREQValue[2]); OrderInfomation oi = new OrderInfomation(Convert.ToInt32(value[0]), Convert.ToInt32(value[1]), DateTime.Now.ToString("ddMMyyyy"), initiateResponse.getTransID(), initiateResponse.getBrandID(), Convert.ToDouble(value[2])); PaymentInstructions pi = new PaymentInstructions(value[3], value[4], value[5], Convert.ToDouble(value[2]), initiateResponse.getTransID(), initiateResponse.getBrandID()); customerPrivateKey = File.ReadAllText(value[6]); customerCertificate = new X509Certificate2(value[7], "123456"); PurchaseRequest purchaseRequest = new PurchaseRequest(oi.OIToString(), pi.PIToString(), customerPrivateKey, gatewayPublicKey, c.ByteArrayToString(customerCertificate.GetRawCertData())); c.send(purchaseRequest.ToMessage(), client); //nhận purchase response receiveMessage = c.receive(client); string[] splitRES = receiveMessage.Split('-'); PurchaseResponse purchaseResponse = new PurchaseResponse(splitRES[0], splitRES[1], splitRES[2]); Console.WriteLine("verify purchase response: " + purchaseResponse.verify()); //Console.WriteLine(purchaseResponse.getMessage()); Console.Read(); }
private void GetMedicalVendorPaymentInstructions(PaymentInstructions instructions) { if (instructions == null) { return; } txtAccountHolder.Text = instructions.AccountHolderName; txtAccountNo.Text = instructions.AccountNumber; ddlAccountType.Items.FindByValue(Convert.ToString((int)instructions.AccountType)).Selected = true; ddlInterval.Items.FindByValue(Convert.ToString((int)instructions.Interval)).Selected = true; ddlPayMode.Items.FindByValue(Convert.ToString((int)instructions.PaymentMode)).Selected = true; txtBankName.Text = instructions.BankName; txtMemo.Text = instructions.Memo; txtRoutingNumber.Text = instructions.RoutingNumber; txtSplInstruction.Text = instructions.SpecialInsructions; }
private void button3_Click(object sender, EventArgs e) { bool verify; string s; Common c = new Common(); IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(iep); //tạo init request gửi tới merchant InitiateRequest initiateRequest = new InitiateRequest(); c.send(initiateRequest.ToMessage(), ref client); //nhận init response từ merchant string receiveMessage = c.receive(ref client); string[] initRES = receiveMessage.Split('-'); merchantCertificate = new X509Certificate2(c.StringToByteArray(initRES[2])); gatewayCertificate = new X509Certificate2(c.StringToByteArray(initRES[3])); if (c.VerifyCertificate(caCertificate, merchantCertificate) == false || c.VerifyCertificate(caCertificate, gatewayCertificate) == false)//xác thực chứng chỉ nhận được { s = "Xác thực kết nối thất bại"; openThongBaoForm(s); } else { merchantPublicKey = merchantCertificate.GetRSAPublicKey().ToXmlString(false); gatewayPublicKey = gatewayCertificate.GetRSAPublicKey().ToXmlString(false); verify = c.Verify(merchantPublicKey, initRES[1], initRES[0]); if (verify == false) { s = "Xác thực kết nối thất bại"; openThongBaoForm(s); } else { //tạo purchase request string[] initREQValue = initRES[0].Split(':'); InitiateResponse initiateResponse = new InitiateResponse(initREQValue[0], initREQValue[1], initREQValue[2]); OrderInfomation oi = new OrderInfomation(maDH, maKH, DateTime.Now.ToString("ddMMyyyy"), initiateResponse.getTransID(), initiateResponse.getBrandID(), soTien); PaymentInstructions pi = new PaymentInstructions(cardNumber, CVV, dateValid, soTien, initiateResponse.getTransID(), initiateResponse.getBrandID()); PurchaseRequest purchaseRequest = new PurchaseRequest(oi.OIToString(), pi.PIToString(), customerPrivateKey, gatewayPublicKey, c.ByteArrayToString(customerCertificate.GetRawCertData())); c.send(purchaseRequest.ToMessage(), ref client); //nhận purchase response receiveMessage = c.receive(ref client); string[] splitRES = receiveMessage.Split('-'); PurchaseResponse purchaseResponse = new PurchaseResponse(splitRES[0], splitRES[1], splitRES[2]); merchantCertificate = new X509Certificate2(c.StringToByteArray(purchaseResponse.getCertificate())); if (c.VerifyCertificate(caCertificate, merchantCertificate) == false)//xác thực chứng chỉ từ purchase response { s = "Xác thực kết nối thất bại"; openThongBaoForm(s); } else { if (purchaseResponse.verify() == false) { s = "Xác thực kết nối thất bại"; openThongBaoForm(s); } else { string[] splitPurchase = purchaseResponse.getMessage().Split(':');//message = transid:RRPID:maKQ:KQ if (splitPurchase[2].CompareTo("1") == 0) { KetQua form = new KetQua("Thanh toán thành công"); form.Show(); this.Hide(); this.Close(); } else if (splitPurchase[2].CompareTo("2") == 0) { s = "Thông tin tài khoản không đúng"; openThongBaoForm(s); } else { s = "Xác thực kết nối thất bại"; openThongBaoForm(s); } } } client.Close(); } } }
public ActionResult Index(FormCollection collection) { bool verify; cardNumber = collection["CardNumber"]; CVV = collection["CVV"]; dateValid = collection["DateValid"]; Common c = new Common(); //lấy dữ liệu /* * System.IO.Stream s=PrivateKey.InputStream; * byte[] buffer = new byte[1024]; * using (MemoryStream ms = new MemoryStream()) * { * int read; * while ((read = s.Read(buffer, 0, buffer.Length)) > 0) * { * ms.Write(buffer, 0, read); * } * byte[] privateKeyByte = ms.ToArray(); * customerPrivateKey = System.Text.Encoding.ASCII.GetString(privateKeyByte); * } * s.Flush(); * s = Certificate.InputStream; * using (MemoryStream ms = new MemoryStream()) * { * int read; * while ((read = s.Read(buffer, 0, buffer.Length)) > 0) * { * ms.Write(buffer, 0, read); * } * byte[] certificateByte = ms.ToArray(); * customerCertificate = new X509Certificate2(certificateByte); * }*/ //khởi tạo kết nối đến customer IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(iep); //tạo init request gửi tới merchant InitiateRequest initiateRequest = new InitiateRequest(); c.send(initiateRequest.ToMessage(), ref client); //nhận init response từ merchant string receiveMessage = c.receive(ref client); string[] initRES = receiveMessage.Split('-'); merchantCertificate = new X509Certificate2(c.StringToByteArray(initRES[2])); gatewayCertificate = new X509Certificate2(c.StringToByteArray(initRES[3])); if (c.VerifyCertificate(caCertificate, merchantCertificate) == false || c.VerifyCertificate(caCertificate, gatewayCertificate) == false)//xác thực chứng chỉ nhận được { ViewBag.thongbao = "Xác thực kết nối thất bại"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else { merchantPublicKey = merchantCertificate.GetRSAPublicKey().ToXmlString(false); gatewayPublicKey = gatewayCertificate.GetRSAPublicKey().ToXmlString(false); verify = c.Verify(merchantPublicKey, initRES[1], initRES[0]); if (verify == false) { ViewBag.thongbao = "Xác thực kết nối thất bại"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else { //tạo purchase request string[] initREQValue = initRES[0].Split(':'); InitiateResponse initiateResponse = new InitiateResponse(initREQValue[0], initREQValue[1], initREQValue[2]); OrderInfomation oi = new OrderInfomation(maDH, maKH, DateTime.Now.ToString("ddMMyyyy"), initiateResponse.getTransID(), initiateResponse.getBrandID(), soTien); PaymentInstructions pi = new PaymentInstructions(cardNumber, CVV, dateValid, soTien, initiateResponse.getTransID(), initiateResponse.getBrandID()); PurchaseRequest purchaseRequest = new PurchaseRequest(oi.OIToString(), pi.PIToString(), customerPrivateKey, gatewayPublicKey, c.ByteArrayToString(customerCertificate.GetRawCertData())); c.send(purchaseRequest.ToMessage(), ref client); //nhận purchase response receiveMessage = c.receive(ref client); string[] splitRES = receiveMessage.Split('-'); PurchaseResponse purchaseResponse = new PurchaseResponse(splitRES[0], splitRES[1], splitRES[2]); merchantCertificate = new X509Certificate2(c.StringToByteArray(purchaseResponse.getCertificate())); if (c.VerifyCertificate(caCertificate, merchantCertificate) == false)//xác thực chứng chỉ từ purchase response { ViewBag.thongbao = "Xác thực kết nối thất bại"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else { if (purchaseResponse.verify() == false) { ViewBag.thongbao = "Xác thực kết nối thất bại"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else { string[] splitPurchase = purchaseResponse.getMessage().Split(':');//message = transid:RRPID:maKQ:KQ if (splitPurchase[2].CompareTo("1") == 0) { return(RedirectToAction("KetQua", new { kq = "Thanh toán thành công" })); } else if (splitPurchase[2].CompareTo("2") == 0) { ViewBag.thongbao = "Thông tin tài khoản không đúng"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else if (splitPurchase[2].CompareTo("3") == 0) { ViewBag.thongbao = "Số tiền thanh toán vượt quá hạn mức của thẻ"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } else { ViewBag.thongbao = "Xác thực kết nối thất bại"; ViewBag.TaiKhoan = tenKH; ViewBag.SoLuong = soLuong; ViewBag.SoTien = soTien; return(this.View()); } } } } } }
public static void Thread1(object sock) { string gatewayPrivateKey = File.ReadAllText("d:/file/gatewayPrivateKey.xml"); X509Certificate2 caCertificate = new X509Certificate2("d:/file/ca.crt"); X509Certificate2 gatewayCertificate = new X509Certificate2("d:/file/gateway.crt"); X509Certificate2 issuerCertificate = new X509Certificate2("d:/file/issuer.crt"); X509Certificate2 customerCertificate, merchantCertificate; string sendMessage; Common c = new Common(); Socket socket = (Socket)sock; //nhận auth request string receiveMessage = c.receive(ref socket); string[] tam = receiveMessage.Split('-'); customerCertificate = new X509Certificate2(c.StringToByteArray(tam[4])); merchantCertificate = new X509Certificate2(c.StringToByteArray(tam[5])); if (c.VerifyCertificate(caCertificate, customerCertificate) == false || c.VerifyCertificate(caCertificate, merchantCertificate) == false) { Console.WriteLine("verify authorization request certificate false"); string message = "ERROR" + "-" + 4 + "-" + "xac thuc that bai"; c.send(message, ref socket); } else { AuthorizationRequest authorizationRequest = new AuthorizationRequest(tam[0], tam[1], tam[2], tam[3], tam[4], tam[5], tam[6]); if (authorizationRequest.Verify(gatewayPrivateKey) == false) { Console.WriteLine("verify authorization request false"); string s = "ERROR" + "-" + 4 + "-" + "xac thuc that bai"; c.send(s, ref socket); } else { Console.WriteLine("verify authorization request true"); //chuyển auth request đến issuer string issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); string PI = authorizationRequest.getPI(gatewayPrivateKey); string[] splitPI = PI.Split(':'); PaymentInstructions paymentInstructions = new PaymentInstructions(splitPI[0], splitPI[1], splitPI[2], splitPI[3], splitPI[4], splitPI[5], Convert.ToInt64(splitPI[6])); string RRPID = paymentInstructions.getRRPID(); paymentInstructions.setRRPID(c.Random(2)); ForwardAuthorizationRequest forwardAuthorization = new ForwardAuthorizationRequest(paymentInstructions.PIToString(), issuerPublicKey); sendMessage = forwardAuthorization.ToMessage(); //kết nối issuer IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1236); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(iep); c.send(sendMessage, ref client); //nhận kq response từ issuer receiveMessage = c.receive(ref client); string[] splitRES = receiveMessage.Split('-'); issuerCertificate = new X509Certificate2(c.StringToByteArray(splitRES[2])); if (c.VerifyCertificate(caCertificate, issuerCertificate) == true) { Console.WriteLine("verify authorization response certificate from issuer true"); issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); bool verifyRES = c.Verify(issuerPublicKey, splitRES[1], splitRES[0]); if (verifyRES == true) { Console.WriteLine("verify authorization response from issuer true"); //tạo và gửi auth response string[] splitIssuerRES = splitRES[0].Split(':'); //kiểm tra response từ issuer có ERROR hay không if (splitIssuerRES[0].CompareTo("ERROR") == 0) { string message = splitIssuerRES[0] + ":" + RRPID + ":" + splitIssuerRES[1] + ":" + splitIssuerRES[2]; X509Certificate2 certificate2 = new X509Certificate2(c.StringToByteArray(authorizationRequest.getMerchantCertificate())); string publicKeyMerchant = certificate2.GetRSAPublicKey().ToXmlString(false); AuthorizationResponse authorizationResponse = new AuthorizationResponse(message, publicKeyMerchant); c.send(authorizationResponse.ToMessageNoToken(), ref socket); } else { string message = splitIssuerRES[0] + ":" + RRPID + ":" + splitIssuerRES[1] + ":" + splitIssuerRES[2]; CaptureToken token = new CaptureToken(paymentInstructions.getTransID(), paymentInstructions.getCardNumber(), paymentInstructions.getTien()); X509Certificate2 certificate2 = new X509Certificate2(c.StringToByteArray(authorizationRequest.getMerchantCertificate())); string publicKeyMerchant = certificate2.GetRSAPublicKey().ToXmlString(false); AuthorizationResponse authorizationResponse = new AuthorizationResponse(message, publicKeyMerchant); authorizationResponse.setCaptureToken(token.ToMessage()); c.send(authorizationResponse.ToMessage(), ref socket); //nhận capture request receiveMessage = c.receive(ref socket); string[] splitCapture = receiveMessage.Split('-'); merchantCertificate = new X509Certificate2(c.StringToByteArray(splitCapture[6])); if (c.VerifyCertificate(caCertificate, merchantCertificate) == false) { Console.WriteLine("verify capture request certificate false"); string message1 = "ERROR" + "-" + 4 + "-" + "xac thuc that bai"; c.send(message1, ref socket); } else { Console.WriteLine("verify capture request certificate true"); CaptureRequest captureRequest = new CaptureRequest(splitCapture[0], splitCapture[1], splitCapture[2], splitCapture[3], splitCapture[4], splitCapture[5], splitCapture[6]); if (captureRequest.Verify() == false) { Console.WriteLine("verify capture request false"); message = "ERROR" + "-" + 4 + "-" + "xac thuc that bai"; c.send(message, ref socket); } else { Console.WriteLine("verify capture request true"); //chuyển capture request tới issuer sendMessage = captureRequest.messageToIssuer(); c.send(sendMessage, ref client); //nhận message từ issuer receiveMessage = c.receive(ref client); string[] splitCaptureRES = receiveMessage.Split('-'); issuerCertificate = new X509Certificate2(c.StringToByteArray(splitCaptureRES[2])); if (c.VerifyCertificate(caCertificate, issuerCertificate) == true) { Console.WriteLine("verify capture response certificate from issuer true"); issuerCertificate = new X509Certificate2(c.StringToByteArray(splitCaptureRES[2])); issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); if (c.Verify(issuerPublicKey, splitCaptureRES[1], splitCaptureRES[0]) == true) { Console.WriteLine("verify capture response from issuer true"); //tạo capture response gừi tới merchant string[] split = splitCaptureRES[0].Split(':'); message = split[0] + ":" + captureRequest.getRRPID() + ":" + split[1] + ":" + split[2]; CaptureResponse captureResponse = new CaptureResponse(message, publicKeyMerchant); c.send(captureResponse.ToMessage(), ref socket); } } client.Close(); } } } } } } } socket.Close(); }
public MedicalVendorEditModel ToModel(MedicalVendor organization, AddressEditModel billingAddress, AddressEditModel businessAddress, File logoImage, File teamImage, PaymentInstructions instructions, TestPayRate[] payRates, decimal customerPayRate, TestType[] permitted) { var binder = new OrganizationCreateModelBinder(); var model = new MedicalVendorEditModel(); model = binder.ToModel(model, organization, billingAddress, businessAddress, logoImage, teamImage) as MedicalVendorEditModel; model.ContractId = organization.ContractId; model.MedicalVendorType = organization.MedicalVendorType; model.IsHospitalPartner = organization.IsHospitalPartner; //model.CustomerPayRate = customerPayRate; //model.EvaluationMode = organization.EvaluationMode; //model.PaymentInstructions = instructions; //model.PermittedTests = permitted; //model.TestPayRates = payRates; return(model); }
public static void Thread1(object sock) { string sendMessage; Common c = new Common(); Socket socket = (Socket)sock; //nhận auth request string receiveMessage = c.receive(socket); string gatewayPrivateKey = File.ReadAllText("d:/file/gatewayPrivateKey.xml"); string[] tam = receiveMessage.Split('-'); AuthorizationRequest authorizationRequest = new AuthorizationRequest(tam[0], tam[1], tam[2], tam[3], tam[4], tam[5], tam[6]); Console.WriteLine("verify auth request: " + authorizationRequest.Verify(gatewayPrivateKey)); //chuyển auth request đến issuer X509Certificate2 issuerCertificate = new X509Certificate2("d:/file/issuer.crt", "123456"); string issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); string PI = authorizationRequest.getPI(gatewayPrivateKey); string[] splitPI = PI.Split(':'); PaymentInstructions paymentInstructions = new PaymentInstructions(splitPI[0], splitPI[1], splitPI[2], splitPI[3], splitPI[4], splitPI[5], Convert.ToDouble(splitPI[6])); string RRPID = paymentInstructions.getRRPID(); paymentInstructions.setRRPID(c.Random(2)); ForwardAuthorizationRequest forwardAuthorization = new ForwardAuthorizationRequest(paymentInstructions.PIToString(), issuerPublicKey); sendMessage = forwardAuthorization.ToMessage(); //kết nối issuer IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1236); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(iep); c.send(sendMessage, client); //nhận kq response từ issuer receiveMessage = c.receive(client); string[] splitRES = receiveMessage.Split('-'); issuerCertificate = new X509Certificate2(c.StringToByteArray(splitRES[2])); issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); bool verifyRES = c.Verify(issuerPublicKey, splitRES[1], splitRES[0]); Console.WriteLine("verify response from issuer" + verifyRES); //tạo và gửi auth response string[] splitIssuerRES = splitRES[0].Split(':'); string message = splitIssuerRES[0] + ":" + RRPID + ":" + splitIssuerRES[2] + ":" + splitIssuerRES[3]; CaptureToken token = new CaptureToken(paymentInstructions.getTransID(), paymentInstructions.getCardNumber(), paymentInstructions.getTien()); X509Certificate2 certificate2 = new X509Certificate2(c.StringToByteArray(authorizationRequest.getMerchantCertificate())); string publicKeyMerchant = certificate2.GetRSAPublicKey().ToXmlString(false); AuthorizationResponse authorizationResponse = new AuthorizationResponse(message, publicKeyMerchant); authorizationResponse.setCaptureToken(token.ToMessage()); c.send(authorizationResponse.ToMessage(), socket); //nhận capture request receiveMessage = c.receive(socket); string[] splitCapture = receiveMessage.Split('-'); CaptureRequest captureRequest = new CaptureRequest(splitCapture[0], splitCapture[1], splitCapture[2], splitCapture[3], splitCapture[4], splitCapture[5], splitCapture[6]); Console.WriteLine("verify capture request: " + captureRequest.Verify()); //chuyển capture request tới issuer string key = c.Random(8); X509Certificate2 certificate = new X509Certificate2("d:/file/gateway.crt"); sendMessage = c.Sign(gatewayPrivateKey, captureRequest.getCatureRequest()) + "-" + c.EncryptDES(captureRequest.getCatureRequest(), key) + "-" + c.EncryptRSA(issuerPublicKey, key) + "-" + c.ByteArrayToString(certificate.GetRawCertData()); c.send(sendMessage, client); //nhận message từ issuer receiveMessage = c.receive(client); string[] splitCaptureRES = receiveMessage.Split('-'); issuerCertificate = new X509Certificate2(c.StringToByteArray(splitCaptureRES[2])); issuerPublicKey = issuerCertificate.GetRSAPublicKey().ToXmlString(false); Console.WriteLine("verify capture response from issuer: " + c.Verify(issuerPublicKey, splitCaptureRES[1], splitCaptureRES[0])); //tạo capture response gừi tới merchant string[] split = splitCaptureRES[0].Split(':'); message = split[0] + ":" + captureRequest.getRRPID() + ":" + split[2] + ":" + split[3]; CaptureResponse captureResponse = new CaptureResponse(message, publicKeyMerchant); c.send(captureResponse.ToMessage(), socket); Console.Read(); }