您可以在 Flash 10 中播放 S3 签名 url FLV 视频吗?

发布于 2024-07-16 16:47:16 字数 341 浏览 4 评论 0 原文

我想要将 FLV 视频从 S3 服务器加载到我的 Flash 应用程序中。 原始文件需要受到保护(即权限设置为仅对经过身份验证的用户进行读取),因此视频文件将使用签名的 url 进行调用...我已成功将非签名的 url FLV 加载并播放到 Flash 应用程序中。

1) 在投入之前我应该​​注意什么问题?
2) 我需要使用AS3 S3库来生成签名吗?
3) 我可以在应用程序加载时生成 1 个签名(例如从 PHP)并将其发送到 Flash 以与它加载的每个 FLV 文件一起使用吗?
4) 图像和音频也将被加载到 Flash 应用程序中,并且也需要受到保护。

谢谢 斯蒂芬

I am wanting to load FLV videos from S3 server into my Flash application. The original files will need to be protected (ie permissions set to read only for authenticated users) so the video files will be called with a signed url... I have managed to load and play non-signed url FLV's into the Flash app.

1) Any issues I should be aware of before diving in?
2) Will I need to use the AS3 S3 library to generate signatures?
3) Can I generate 1 signature when the app loads (eg from PHP) and send this to Flash to use with each FLV file it loads?
4) Images and audio will also be loaded into the Flash app and will need to be protected also.

Thanks
Stephen

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酸甜透明夹心 2024-07-23 16:47:16

是的,您可以在 Flash 中播放签名网址,没问题...

通过阅读,我已经设法回答了我自己的几个问题 -

1)是的,很多!
2) 从 Flash 中对 url 进行签名不是一个好主意,因为密钥需要位于 SWF 中或从 PHP 加载,因此这里可能存在安全风险。 最好在服务器上调用 PHP 方法来生成签名 URL 并将文件返回到 Flash/返回文件的路径(sendAndLoad?)。 但这似乎确实是一个额外的步骤,可以以某种方式绕过!
3) 仍然不确定这一点,但我认为签名过程涉及使用文件的路径,因此每个 url 的每个签名都是唯一的 - 这是正确的吗?

有人对此有进一步的建议吗?
斯蒂芬

Yes you can play signed urls in Flash no problem...

from reading around I have managed to answer a couple of my own questions -

1) Yes lots!
2) Not a good idea to sign urls from within Flash as the secret key would need to be in the SWF or loaded from PHP so could be a security risk here. It is probably best to call a PHP method on the server to generate a signed url and return the file to Flash / return the path to the file (sendAndLoad?). But this does seem like an extra step that could be bypassed somehow!
3) Still not sure about this but I think that the signing process involves using the path to the file so each signature for each url is unique - is this correct?

Anyone have further advice on this?
Stephen

梦里南柯 2024-07-23 16:47:16

显然,我花了无数个小时在我的网站上尝试对 MP3 文件进行同样的操作。 回答:

1)
任务不太复杂。 (尽管我有无数个小时)

2)
不要从 Flash 中签署 URL。 使用托管 PHP 文件,您可以向该文件发出 AJAX 请求来获取签名 URL。 为此,S3 存储桶的目录结构必须具有一致的模式,使得在给定某些输入的情况下可以通过编程确定文件位置。

我不认为这是一个可以绕过的过程。 URL 签名只能在服务器端完成,而不能在客户端完成。 如果您想查看我的 AJAX 示例代码,请告诉我。 我把它贴在这里给你

3)
签名过程至少使用三个变量来创建签名 - 时间戳、文件位置(存储桶/文件夹/floder/文件)、S3 密钥。 因此,每个文件请求都应有一个单独的签名。 签名的 URL 的有效性应该非常有限(例如 10 秒)。 在这 10 秒内找到 URL 的用户就可以下载该文件。

仅随时间戳而变化的签名可能会(在很大程度上,如果不是完全的话)无法实现签名 URL 的全部目的。

要签署 URL,请使用以下脚本。 它就像魅力一样,如果我能及时拿到它,我会节省很多时间。 另请参阅下面的第 5 点以获取额外的安全性。

http://www.richardpeacock.com /blog/2010/07/amazon-aws-s3-query-string-authentication-php

4)
由于某种原因,FLASH 播放器无法播放 MP3 文件的签名 S3 URL。 我认为(猜测)一旦读取了 URL 中的 .mp3 扩展名,他们就会忽略 URL 的部分。 因此,播放器会忽略 URL 的查询字符串部分,并且无法读取文件。 不过,他们在我的 S3 Bucker 中播放可公开读取的文件。 我一直在我的网站上使用 silverlight,现在正在拼命地使用 FLASH 解决方案。 如果这就是受保护的 FLV 文件也无法播放的原因。 在这种情况下,您必须将整个文件代理到您的客户端(仅包含 URL)。 我试图避免的解决方案。

5)
为了进一步保护您的 URL,请使用链接中的一种或多种方法对其进行混淆
以下。 它们很简单。

http://www.pc-help.org/obscure.htm

6)
此外,您的安全方法必须是在 URL 过期之前在浏览器上启动文件播放。 到期时间段必须足够短,以防止在到期前进行 URL 检测,并且必须足够长,以提供足够的延迟来开始播放。 这或多或少是使用自过期 URL 进行相当安全的流传输的关键。

Apparently I have spent a gazillion hours trying the same with MP3 files for my web site. To answer:

1)
Not too complicated a task. (despite my Gazillion hrs)

2)
Do not sign URLs from within Flash. Use an Hosted PHP file to which you can make an AJAX request to obtain signed URLs. For this the directory structure of ur S3 bucket must have a consistent pattern that makes the file location, given some input, programatically determinable.

I don't this this is a process that can be bypassed. URL Signing must only be done server side and never client side. Let me know if you want to see my AJAX sample code. Ill paste it here for you

3)
The signing process uses a minimum of three variables to create a signature - the timestamp, file location (bucket/folder/floder/file) , S3 Secret Key . Hence, Each request for a file shall have a separate signature. The signed URLs should have a very limited validity (say 10 seconds). Users who can find out the URL withse those 10 seconds shall be able to download the file.

Having signatures that vary with timestamp alone might defeat (largely if not fully) the whole purpose of having signed URLs.

To sign URLs, use the script below. It works like charm and would have save me a lot of hours had I got it on time. Also look at point 5 below for additional security.

http://www.richardpeacock.com/blog/2010/07/amazon-aws-s3-query-string-authentication-php

4)
For some reason FLASH players are not playing Signed S3 URLs for MP3 Files. I think (GUESS) they ignore the part of the url once the .mp3 extention in the URL is read. Thus the query string part of the URL is ignored by the player and it can't read the file. They play publically reabable files in my S3 Bucker though. I have been using silverlight for my site amd am desparately using for a FLASH solution. If that be the reason protected FLV Files wont play either. In this case you will have to proxy the whole file to your client insted of the URL alone. A solution I am trying to avoid.

5)
to further protect ur URLs, obfuscate them using one or more of the methords in the link
below. They are very simple.

http://www.pc-help.org/obscure.htm

6)
Further, your security approach must be to be initiate playback of the file on the browser before the URL expires. Th expiry time period must be short enough to prevent URL detection before expiry and must be long enough to provide enuf latency to begin playback. This is more or less the crux of reasonably secure streaming using self expiring URLs.

猛虎独行 2024-07-23 16:47:16

要回答您的具体观点

,您需要注意的问题:我的第一个答案中的第4点;

需要 Amazon S3 库吗? :是的,但不是真的,我第一个答案中的第3点,链接中的脚本可以在不参考文档的情况下使用,但是您需要了解亚马逊的签名方法

只需使用1个签名? :不推荐,无法达到使用签名的所有目的,可能不会,因为我认为签名强制使用文件路径和名称

音频和音频。 图像保护:所有保护都是合理的(假设您的最终用户没有时间或知识限制并且可以编写代码)。

图像:使用 Javascript 禁用右键单击,音频:可以通过一些修补来下载流,这可能会让事情变得复杂。

通过禁用 JavaScript 或从 JS Scratchpad / Console 中输入 JS 代码,图像肯定可以下载。因此,即使检测 JS 是否启用也无助于保护图像。

To answer your specific points

Issues you need to be aware of : Point 4 in the my 1st answer ;

Amazon S3 Library Required ? : Yes but not really, Point 3 in my 1st answer, Script in the link can be used without referring to the documentation, But youll need to understand Amazons signing method

Just use 1 signature ? : Not Recommended, Defeats all purpose of using a signature, Probably no since I think signature mandatorly uses the file path and name

Audio & Image Protection: All protection is only reasonable (assuming your end uses have no time or knowledge constraint and can write code).

Images : Use Javascript to disable right click, Audio : Streams can be downloaded with some tinkering which you can complicate.

Images would be certainly downloadable by disabling JavaScript or punching JS code from the JS Scratchpad / Console.. So even detecting if JS is enabled won't help protect images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文