コード例 #1
0
        private string EncrptXML(string xml)
        {
            try
            {
                string skey_encryption = Encryption.GetEncryptedText(Convert.ToBase64String(sessionKey.Key),
                                                                     Decryption.Decrypt_usingpassword(System.Configuration.ConfigurationManager.AppSettings["TAPublic_Key"].ToString()));

                string encrypted_data = Encryption.AESEncryption(xml, Convert.ToBase64String(sessionKey.Key), false);


                XmlDocument Request_auth = new XmlDocument();

                XmlElement root_element = Request_auth.CreateElement("TA");
                Request_auth.AppendChild(root_element);

                XmlElement Data = Request_auth.CreateElement("Data");
                Data.InnerText = encrypted_data;
                root_element.AppendChild(Data);

                XmlElement Session_Key = Request_auth.CreateElement("S_KEY");
                Session_Key.InnerText = skey_encryption;
                root_element.AppendChild(Session_Key);


                return("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" + Request_auth.OuterXml);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public dynamic TAWalletEncryptedKey(TAWalletpaymentModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                if (string.IsNullOrEmpty(obj.user_id) || string.IsNullOrEmpty(obj.service_name) || string.IsNullOrEmpty(obj.transaction_desc) || string.IsNullOrEmpty(obj.order_id) || string.IsNullOrEmpty(obj.amount) || string.IsNullOrEmpty(obj.callback_url))
                {
                    objdata.status = 200;
                    objdata.result = "Missing Input Parameters";
                    return(objdata);
                }

                string description = obj.service_name + " $^$" + obj.transaction_desc + "$^$" + obj.user_id + "$^$";
                string strstring   = "900020" + "&" + obj.order_id + "&" + description + "&" + obj.amount + "&" + obj.callback_url;

                string skey_encryption = Encryption.GetEncryptedText(Convert.ToBase64String(sessionKey.Key), Decryption.Decrypt_usingpassword(System.Configuration.ConfigurationManager.AppSettings["TAPublic_Key"].ToString()));
                string encrypted_data  = Encryption.AESEncryption(strstring, Convert.ToBase64String(sessionKey.Key), false);

                objdata.status  = 200;
                objdata.result  = encrypted_data;
                objdata.sec_key = skey_encryption;
                objdata.url     = "https://staging.transactionanalysts.com:444/TAPaymentGateway/RequestHandler.aspx";
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }