public string EncryptSourceData(IAopRequest <T> request, string body, string encryptType, string encryptKey, string charset)
        {
            EncryptParseItem encryptParseItem = ParseEncryptData(request, body);
            string           str  = body.Substring(0, encryptParseItem.startIndex);
            string           str2 = body.Substring(encryptParseItem.endIndex);
            string           str3 = AlipayEncrypt.AesDencrypt(encryptKey, encryptParseItem.encryptContent, charset);

            return(str + str3 + str2);
        }
示例#2
0
        public string EncryptSourceData(IAopRequest <T> request, string body, string encryptType, string encryptKey, string charset)
        {
            EncryptParseItem item = ParseEncryptData(request, body);

            string bodyIndexContent = body.Substring(0, item.startIndex);
            string bodyEndContent   = body.Substring(item.endIndex);
            string encryptContent   = AlipayEncrypt.AesDencrypt(encryptKey, item.encryptContent, charset);

            return(bodyIndexContent + encryptContent + bodyEndContent);
        }
        public string EncryptSourceData(IAopRequest <T> request, string body, string encryptType, string encryptKey, string charset)
        {
            if (!"AES".Equals(encryptType))
            {
                throw new AopException("API only support AES!");
            }
            EncryptParseItem encryptParseItem = parseEncryptData(request, body);
            string           str  = body.Substring(0, encryptParseItem.startIndex);
            string           str2 = body.Substring(encryptParseItem.endIndex);
            string           str3 = AlipayEncrypt.AesDencrypt(encryptKey, encryptParseItem.encryptContent, charset);

            return(str + str3 + str2);
        }
示例#4
0
        public string EncryptSourceData(IAopRequest <T> request, string body, string encryptType, string encryptKey, string charset)
        {
            if (!"AES".Equals(encryptType))
            {
                throw new AopException("API only support AES!");
            }

            EncryptParseItem item = parseEncryptData(request, body);

            string bodyIndexContent = body.Substring(0, item.startIndex);
            string bodyEndexContent = body.Substring(item.endIndex);

            //TODO 解密逻辑
            string bizContent = AlipayEncrypt.AesDencrypt(encryptKey, item.encryptContent, charset);

            return(bodyIndexContent + bizContent + bodyEndexContent);
        }
示例#5
0
        public void should_get_correct_plaintext()
        {
            String plaintext = AlipayEncrypt.AesDencrypt("aa4BtZ4tspm2wnXLb1ThQA==", "ILpoMowjIQjfYMR847rnFQ==", "utf-8");

            Assert.AreEqual(plaintext, "test1234567");
        }