如何使用 Flash 加密/解密 FLV
我正在开发一个 Windows 应用程序(在 .NET 中创建),其功能之一是使用 SWF 组件播放本地 FLV。
现在我需要创建一个加密应用程序以确保这些 FLV 无法自由播放,只有 SWF 播放器知道如何解密该文件(使用从 .NET 应用程序收到的密钥)。
我正在考虑创建一个 Air 应用程序来编码我的 flvs(也许是 ByteArray 类?),使用某种算法根据键字符串对字符进行洗牌/取消洗牌。
我的主要需求是如何使用 Air/Flash 对文件进行编码/解码。 我尝试了几次,只是尝试加载 FLV,转换为 ByteArray,然后保存新的 FLV,但这个新的 FLV 无法播放。打开 Notepad++,我注意到该文件在 FLV 标头之前有几个字符。
有人知道如何正确地做到这一点吗?谢谢!
I'm working on an Windows application(created in .NET) which one of its functions is to play local FLVs using SWF components.
Now I need to create an encryption application to make sure those FLVs cannot be played freely, only the SWF player will know how to decrypt that file(using a key received from .NET app).
I was thinking of creating an Air app to encode my flvs (maybe ByteArray class?), using some algorithm to shuffle/unshuffle characters based in a key string.
My main need is how to encode/decode a file using Air/Flash.
I tried some times, just trying to load a FLV, convert to ByteArray, then save the new FLV, but this new FLV won't play. Opening into Notepad++, I noticed the file have a few characters before it's FLV header.
Anyone knows how to do that correctly? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果有人有权访问 SWF,他们就可以对其进行反编译,并了解如何解密您的 FLV。
更好的方法是使用 AES 等加密它们,然后从服务器获取密钥。
如果您不担心人们反编译您的 SWF,只需执行任何会导致媒体播放器无法打开它的操作即可。
是的,您可以使用
ByteArray
来修改您的 FLV。关于额外的字节,您不应该“转换”为 ByteArray,当您收到它时它应该已经是这种格式。听起来好像您以某种方式将其放在
String
中,并且使用了writeUTF
,它在开头写入长度。If somebody has access to the SWF, they can decompile it, and find out how to decrypt your FLVs.
A better way would be to encrypt them with something like AES, then get the key from a server.
If you're not worried about people decompiling your SWF, just do anything that will cause media players to fail to open it.
Yes, you would use
ByteArray
to modify your FLV.About the extra bytes, you shouldn't be "converting" to
ByteArray
, it should already be in that format when you receive it. It sounds like you somehow had it in aString
and you usedwriteUTF
, which writes the length at the beginning.这是我通过我的经历和谷歌搜索取得的成就的一个例子。工作完美。
使用 ROT128 加密文件,更多信息此处。
Here is a example of what I achieved throught my experiences and googling. Works perfectly.
Using ROT128 to encrypt a file, more info here.