Browse DevX
Sign up for e-mail newsletters from DevX


Distribute Media Securely with Microsoft's Digital Rights Management  : Page 3

Digital Rights Management (DRM) is a solution to online media piracy that requires a user to obtain server-distributed licenses to unlock encrypted content. Learn how to employ this security model using Microsoft's DRM software for Windows Media.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Make Your Packaged Media Available to Customers
Now that the media is packaged, you'll need to make it available to your customers. The sample code contains a store called 'World of Sound' which I recommend installing under the Web application 'DRMStore' on your Web server (see Figure 4).

Figure 4: The 'World of Sound' Sample Store

The sample uses free tracks to avoid the unnecessary complexity of introducing a payment model. If a user chooses to download a track, the file opens in the preferred player, which should be Media Player by default. When other players (such as WinAmp) are registered to handle Windows Media file types, and you have opted not to support DRM v.1 licensing, problems may arise. I recommend that you demand your customers use Media Player 7, because DRM version.1 has significant drawbacks and the techniques required to bypass its security are widely known. Another noteworthy point is that Windows 95 and NT 4.0 do not support DRM 7.1. It would appear this important share of the market will not be addressed; Microsoft prefers to have its users upgrade to a more multimedia friendly OS such as Windows XP.

When you open a secured track in Media Player 7, the player reads the license acquisition URL to attempt to license its secured content. The request executes an ASP page on the server that forwards the 'challenge' onto our DRMStore component:

' Create the License Object Set oLicense = Server.CreateObject("DRMStore.License") ' Generate License / Pass the Challenge and Silent details on sLicense = oLicense.IssueLicense(cStr(sChallenge), cBool(bSilent))

The most significant problem you'll encounter when creating a license programmatically is dealing with the WMRMRights object. The COM definition for any numeric property on the object demands the use of a DWORD, a non-compliant data type for COM. This makes it impossible to late-bind to the Rights object; Visual Basic will not compile and will throw an error (see Figure 5). The only workaround is to use CreateObject. In the example code, I have wrapped the Rights object to avoid some of the object's common pitfalls.

Figure 5: Windows Media DRM Rights Object Invalid Interface

When you wish to pop-up a license acquisition screen on the client (non-silent delivery) you must format the license appropriately. The RMGetLicense.StoreLicense method, executed as a client-side COM object, completes license installation through a JavaScript function. Firstly, you must format the license so it will work in JavaScript syntax:

'Format for JavaScript WMRMResponse.ReplaceQuotesWith = "\"""

And on the client side, Media Player will detect the new license and allow the media playing operation to proceed:

<script Language="JavaScript"> function StoreLicense(hr) { GetLicenseObj.StoreLicense( '<%= sLicense %>' ); } </script> </head> <body onload="StoreLicense()"> <object classid= "clsid:A9FC132B-096D-460B-B7D5-1DB0FAE0C062" id="GetLicenseObj"> <embed mayscript type="application/x-drm-v2" hidden="true"> </object>

If you prefer to distribute silently, you don't have to format and store the license as shown above; however, to avoid a license pop-up window from appearing, you must not render any HTML into the license response (see Figure 6).

Figure 6: A License Acquisition Pop-up in Windows Media Player

When the media plays, you'll see the words "Protected Content" rotating on the status bar. (see Figure 7).

Figure 7: Windows Media Player Playing DRM-secured Media

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date