Ejemplo n.º 1
0
        public dynamic Encypt_datathird(string obj)
        {
            dynamic objenc = new ExpandoObject();

            try
            {
                // string json = JsonConvert.SerializeObject(obj);

                string iv  = CryptLib.GenerateRandomIV(16);
                string key = CryptLib.getHashSha256("GSWS TEST", 32);

                string encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj, key, iv);

                object obj1 = new
                {
                    UserID   = "codetreevs",
                    Mobile   = "",
                    Password = "******",
                    RegMail  = "",
                    AppType  = "codetreeration"
                };

                var data = new EncryptDecrypt().PostData(sapandanaurl.tokenurl, obj1);

                spandamurlmodel objspadana = JsonConvert.DeserializeObject <spandamurlmodel>(data);

                if (objspadana.StatusCode == 200 && objspadana.Status == "Success")
                {
                    objenc.Status      = 100;
                    objenc.encrypttext = encrypttext;
                    objenc.key         = iv;
                    objenc.Reason      = "";
                    objenc.url         = objspadana.url;
                    objenc.SToken      = objspadana.Token;
                }
                else
                {
                    objenc.Status = 102;
                    objenc.Reason = objspadana.Message;
                    //objenc.url = objspadana.url;
                    objenc.SToken = objspadana.Token;
                }
                return(objenc);
            }
            catch (Exception ex)
            {
                objenc.Status = 102;
                objenc.Reason = ex.Message.ToString();
                return(objenc);
            }
        }
Ejemplo n.º 2
0
        public string Token()
        {
            object obj = new
            {
                UserID   = "codetreevs",
                Mobile   = "",
                Password = "******",
                RegMail  = "",
                AppType  = "codetreeration"
            };

            var data = new EncryptDecrypt().PostData(sapandanaurl.tokenurl, obj);

            spandamurlmodel objdata = JsonConvert.DeserializeObject <spandamurlmodel>(data);

            return(objdata.Token);
        }