Пример #1
0
        public void DoDecryption()
        {
            //如果需要解密
            String path = this.m_Headers.RequestPath;

            if (this.m_entityBody == null || this.m_entityBody.Length == 0)
            {
                this.myControl.clearText();
            }
            else
            {
                if (path.Contains("skey"))
                {
                    String skey = Regex.Split(path, "skey=")[1];
                    //此种方式才能将byte[]转换成常见的base64编码的字符串
                    String base64Body = System.Text.Encoding.Default.GetString(this.m_entityBody);
                    //此种方式转不了base64编码格式的字符串
                    String decryptionBody = BodyDecryption.decryptSDKBody(skey, base64Body);
                    myControl.setText(decryptionBody);
                }
                else
                {
                    String decodeBody = System.Text.Encoding.Default.GetString(this.m_entityBody);
                    myControl.setText(decodeBody);
                }
            }
        }
        public byte[] DoDecryption()
        {
            //如果需要解密
            String path = this.m_Headers.RequestPath;

            if (path.Contains("skey"))
            {
                String skey = Regex.Split(path, "skey=")[1];
                //此种方式才能将byte[]转换成常见的base64编码的字符串
                String base64Body = System.Text.Encoding.Default.GetString(this.m_entityBody);
                //此种方式转不了base64编码格式的字符串
                // String bodytext= Convert.ToBase64String(this.m_entityBody);
                String decryptionBody = BodyDecryption.decryptSDKBody(skey, base64Body);
                byte[] decodeBody     = System.Text.Encoding.UTF8.GetBytes(decryptionBody);
                return(decodeBody);
            }
            else
            {
                this.Clear();
                return(null);
            }
        }