保护来自 Level3 CDN 的 RTMP 流的问题
我目前正在处理来自 Level3 CDN 的 rtmp 流的保护。
该文档可以在这里找到: https://rapidshare.com/files/1450549534/Token_Components.html (看起来需要登录才能查看,因此我重新托管在rapidshare上。原始网址是: https://mediaportal.level3.com/mediaWeb/help /Content/ServicesDocs-Streaming/StreamingTokenAuth/TokenComponents.htm )
向下滚动到按需流输入/输出示例(对于 MP4 文件)
我正在尝试重现该示例并获取具有相同值的相同网址。我为此编写了一个小函数:
function flimmithash($file) {
$streamer = 'pmsales';
$host = 'pmsalesfs.fplive.net';
$start_time = '20080101120000';
$end_time = '20101231235900';
$customer_secret = 'Secret'; // in the documentation there is also secret with a non capital s, i tried both
$resouce_path = "/$streamer/$file"; echo "resouce_path: $resouce_path <br>\n";
$message = "$resouce_path?start_time=$start_time&end_time=$end_time#$customer_secret"; echo "message: $message <br>\n";
$digest = md5($message); echo "digest: $digest <br>\n";
$tokenvalue = "start_time=$start_time&end_time=$end_time&digest=$digest"; echo "tokenvalue: $tokenvalue <br>\n";
$token = base64_encode($tokenvalue); echo "token: $token <br>\n";
$url = "rtmp://$host/$streamer?token=".($token)."/mp4:$file"; echo "url: $url <br>\n";
return $url;
}
echo "url: ".flimmithash('support/lvlt300kbps.mp4')."<br>\n";
我使用与示例中完全相同的值,但只是无法获得相同的摘要。
我用的是md5,因为它匹配长度。我还尝试了大写和非大写的秘密。
您可以在此处查看示例脚本: https://rapidshare.com/files/2581196874/Appendix.html (原文:https:// mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/Appendix-SampleScripts.htm )
但是绝对没有使用md5,他们使用sha1。但 sha1 比示例中的摘要更长。
当然,我尝试用我的值填充这两个版本,但都不起作用。
所以我的问题是:任何人都可以重现该示例和/或告诉我摘要或更改我的函数以根据该示例工作吗?
I am currently dealing with securing rtmp streams from Level3 CDN.
The documentation can be found here:
https://rapidshare.com/files/1450549534/Token_Components.html
(looks like you need to be logged in to view, therefore i re hosted on rapidshare. the original url is:
https://mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/TokenComponents.htm )
Scoll down to On Demand Streaming Input / Output Example ( For MP4 Files )
I am trying to reproduce the example and to get the same url with the same values. I wrote a little function for that:
function flimmithash($file) {
$streamer = 'pmsales';
$host = 'pmsalesfs.fplive.net';
$start_time = '20080101120000';
$end_time = '20101231235900';
$customer_secret = 'Secret'; // in the documentation there is also secret with a non capital s, i tried both
$resouce_path = "/$streamer/$file"; echo "resouce_path: $resouce_path <br>\n";
$message = "$resouce_path?start_time=$start_time&end_time=$end_time#$customer_secret"; echo "message: $message <br>\n";
$digest = md5($message); echo "digest: $digest <br>\n";
$tokenvalue = "start_time=$start_time&end_time=$end_time&digest=$digest"; echo "tokenvalue: $tokenvalue <br>\n";
$token = base64_encode($tokenvalue); echo "token: $token <br>\n";
$url = "rtmp://$host/$streamer?token=".($token)."/mp4:$file"; echo "url: $url <br>\n";
return $url;
}
echo "url: ".flimmithash('support/lvlt300kbps.mp4')."<br>\n";
I use the exact same values as in the example but just cannot get the same digest.
I used md5, because it matches the length. I also tried secret with capital and non capital s.
You can go to sample scripts here: https://rapidshare.com/files/2581196874/Appendix.html (Original: https://mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/Appendix-SampleScripts.htm )
But there is absolutely no md5 used, they use sha1. But sha1 is longer then the digest from the example.
Of course I tried to populate both versions with my values, but neither worked.
So my question is: Can anybody reproduce the example and/or tell me the digest or alter my function to work according to the example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
他们的例子是不正确的。他们给出的摘要是针对文件
/support/lvlt300kbps.flv
的,并且可以使用该文件名的 md5 轻松生成,并使用小写的secret
作为共享密钥。您可以看到它与其文档中上面的 FLV 示例中给出的摘要相同。Their example is incorrect. The digest they give is for the file
/support/lvlt300kbps.flv
and can easily be generated with md5 for that filename, using the lowercasesecret
as the shared secret. You can see it's identical to the digest given in the FLV example just above it in their documentation.