Esempio n. 1
0
        public static (string sig, string auth) GetSignature(string accountSid, string accountToken)
        {
            var date    = DateTime.Now.ToString("yyyyMMddhhmmss");
            var sigstr  = MD5HashingProvider.Signature($"{accountSid}{accountToken}{date}").ToUpper();
            var authStr = Base64ConvertProvider.Encode($"{accountSid}:{date}", Encoding.UTF8);

            return(sigstr, authStr);
        }
        public void Test_Encode_4()
        {
            var result = Base64ConvertProvider.Encode("中国");

            Assert.Equal("5Lit5Zu9", result);
        }
        public void Test_Encode_3()
        {
            var result = Base64ConvertProvider.Encode("bhavana");

            Assert.Equal("YmhhdmFuYQ==", result);
        }
        public void Test_Encode_2()
        {
            var result = Base64ConvertProvider.Encode("12345");

            Assert.Equal("MTIzNDU=", result);
        }
        public void Test_Encode_1()
        {
            var result = Base64ConvertProvider.Encode("you");

            Assert.Equal("eW91", result);
        }
Esempio n. 6
0
 public void Base64EncodeTest()
 {
     Assert.Equal("aW1hZ2U=", Base64ConvertProvider.Encode("image", Encoding.UTF8));
     Assert.Equal("5Lit5Zu9", Base64ConvertProvider.Encode("中国", Encoding.UTF8));
 }