3
方案:我們有一個要發佈脫機(DVD-ROM)一個Silverlight 5 OOB應用。此應用程序可用作某些教育內容的媒體播放器。爲了保護那些附帶DVD ROM的視頻文件,我決定用鑰匙獨特的視頻文件進行加密,以每個用戶,出貨的內容和需要播放時,解密。媒體流和CryptoStream的
問題:它如何逐步解密媒體?我不想在一次解密整個文件的內存和性能問題。 MediaElement
支持類型的流的源,但是當我使用CryptoStream
解密視頻文件,並將其傳遞給MediaElement.SetSource
方法,以下拋出異常:
{System.Windows.Media.DrmException: 3121 3121 An error has occurred.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at MS.Internal.XcpImports.MediaElement_SetStreamSource(MediaElement element, Stream stream)
at System.Windows.Controls.MediaElement.SetSource(Stream stream)
at SilverlightApplication4.MainPage.button1_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)}
我使用AES alorithm爲cryptographics操作AesManaged
類。
在此先感謝。
如果你打算上存儲的AES密鑰?如果它在磁盤上與視頻一起,你沒有真正保護自己。 –