Пример #1
0
        public ActionResult DecryptValue()
        {
            EncryptedCard model = new EncryptedCard();

            //Here I am using a static values which is encrypted.
            //CardNumber: 4111111111111111
            //Expiry Month: 01
            //Expiry Year: 2020

            model.CardNumber = "+rBrMbWjMOr44M0dvmiOZutqllU+iCFNDTW25Gi1PRs=";
            model.ExpMonth   = "6px2VegSl2OFtT9CIGaETQ==";
            model.ExpYear    = "PF+aUcgj/KiQlBI9ahz6EQ==";

            return(View(model));
        }
Пример #2
0
        public ActionResult DecryptValue(EncryptedCard model)
        {
            //SecurityKey can be any unique key which is used to Encrypt and Decript a value.
            //You will have to pass this SecurityKey along with the text you want to Cipher.
            //SecurityKey can be customer's any unique value, for example: userId/CustomerGUID/Email etc.
            string SecurityKey = "9898jdhjd7";//(passPhrase) value

            string DecryptedCardNumber = StringCipher.Decrypt(model.CardNumber, SecurityKey);
            string DecryptedExpMonth   = StringCipher.Decrypt(model.ExpMonth, SecurityKey);
            string DecryptedExpYear    = StringCipher.Decrypt(model.ExpYear, SecurityKey);


            ViewBag.DecryptedCardNumber = DecryptedCardNumber;
            ViewBag.DecryptedExpMonth   = DecryptedExpMonth;
            ViewBag.DecryptedExpYear    = DecryptedExpYear;

            return(View());
        }