HLS-AES 128 格式视频服务,flash 通过 https 获取加密密钥失败原因以及解决方法

HLS-AES 128 加密是常用的 HLS 加密方式,但是最近在 HLS 视频服务器切换到加密模式时缺出现了 flash 客户端预览视频失败的情况,经排查是取 key 失败,查询服务器日志发现请求根本没有发送,所以几乎可以断定是 flash 跨域问题。

查询 crossdomain.xml 官方文档,发现文档中中有一个 secure 属性,是这么说的:

secure: [HTTPS and Sockets only, optional] Specifies whether access is granted only to HTTPS 

documents from the specified origin (true) or to all documents from the specified origin (false). 

If secure is not specified in an HTTPS policy file, it defaults to true. Using false in an HTTPS 

policy file is not recommended because this compromises the security offered by HTTPS; for 

example, allowing man-in-the-middle attacks to gain access to the HTTPS data protected by the 

policy file. 

In socket policy files, the default is false. It is only useful to specify secure=”true” when the 

socket server is accepting connections from the local host since local socket connections are 

generally not at risk of man-in-the-middle attacks that could alter the secure=”true” 

declaration.

换成我自己的语言就是:如果 crossdomain.xml 这个文件本身是https取到的,那么这个地方如果不写的话,就默认 http 不能访问key。反之亦然。

所以问题就简单了,要么修改线段页面把 flash 地址改成 https,要么先临时设置 crossdomain.xml 如下:

<?xml version="1.0“?> 
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
    <allow-access-from domain="某个地址" secure="false" /> 
</cross-domain-policy>

注意后者会降低安全性,临时用一下可以。

转载于:https://my.oschina.net/legendlee/blog/425834

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值