コード例 #1
0
        public void testGeneratePublicSharingKey() //throws Exception
        {
            String channel   = "7d72365eb983485397e3e3f9d460bdda";
            int    ts        = 1446455472;
            int    r         = 58964981;
            string uid       = 2882341273L.ToString();
            int    expiredTs = 1446455471;

            String expected = "004ec32c0d528e58ef90e8ff437a9706124137dc795970ca35de60c44645bbae8a215061b3314464554720383bbf51446455471";
            String result   = DynamicKey4.generatePublicSharingKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

            Assert.Equal(expected, result);
        }
コード例 #2
0
        public void testGenerateMediaChannelKey() //throws Exception
        {
            String appID          = "970ca35de60c44645bbae8a215061b33";
            String appCertificate = "5cfd2fd1755d40ecb72977518be15d3b";
            String channel        = "7d72365eb983485397e3e3f9d460bdda";
            int    ts             = 1446455472;
            int    r         = 58964981;
            string uid       = 2882341273L.ToString();
            int    expiredTs = 1446455471;

            String expected = "005AQAoAEJERTJDRDdFNkZDNkU0ODYxNkYxQTYwOUVFNTM1M0U5ODNCQjFDNDQQAJcMo13mDERkW7roohUGGzOwKDdW9buDA68oN1YAAA==";
            String result   = DynamicKey4.generateMediaChannelKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

            Assert.Equal(expected, result);
        }
コード例 #3
0
        public void testGenerateRecordingKey() //throws Exception
        {
            //String appID = "970ca35de60c44645bbae8a215061b33";
            //String appCertificate = "5cfd2fd1755d40ecb72977518be15d3b";
            String channel   = "7d72365eb983485397e3e3f9d460bdda";
            int    ts        = 1446455472;
            int    r         = 58964981;
            string uid       = 2882341273L.ToString();
            int    expiredTs = 1446455471;

            String expected = "004e0c24ac56aae05229a6d9389860a1a0e25e56da8970ca35de60c44645bbae8a215061b3314464554720383bbf51446455471";
            String result   = DynamicKey4.generateRecordingKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

            Assert.Equal(expected, result);
        }
コード例 #4
0
ファイル: DynamicKey4Test.cs プロジェクト: stjordanis/Tools-2
        public void testGenerateMediaChannelKey() //throws Exception
        {
            //String appID = "970ca35de60c44645bbae8a215061b33";
            //String appCertificate = "5cfd2fd1755d40ecb72977518be15d3b";
            String channel   = "7d72365eb983485397e3e3f9d460bdda";
            int    ts        = 1446455472;
            int    r         = 58964981;
            string uid       = 2882341273L.ToString();
            int    expiredTs = 1446455471;

            String expected = "004d0ec5ee3179c964fe7c0485c045541de6bff332b970ca35de60c44645bbae8a215061b3314464554720383bbf51446455471";
            String result   = DynamicKey4.generateMediaChannelKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

            Assert.Equal(expected, result);
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            var vendor_key = "970ca35de60c44645bbae8a215061b33";
            var sign_key   = "7d72365eb983485397e3e3f9d460bdda";
            //int expiredTs =DateTime.Now.AddSeconds(Duration-TotalTime).ToTimeStamp();//服务截止时间戳(2小时)
            int expiredTs  = DateTime.Now.AddHours(2).ToTimeStamp(); //服务截止时间戳(2小时)
            int unixTs     = DateTime.Now.ToTimeStamp();             //本次请求时间戳
            int randomInt  = new Random().Next() * 100000000;
            var identifier = 0;
            var channelId  = 0;

            // Generates Key for user to join Channel
            String media_channel_key = DynamicKey4.generateMediaChannelKey(vendor_key,
                                                                           sign_key,
                                                                           channelId.ToString(),
                                                                           unixTs,
                                                                           randomInt,
                                                                           identifier,
                                                                           expiredTs);

            Console.WriteLine($"channel key:{media_channel_key}");
        }