Creating the Content Header
The second step in packaging a Windows Media file is to generate the content header. The content header of a file precedes the main content and contains information about the file. In a packaged Windows Media file , the content header is a string that contains the following information:
- Key ID, which is a string that is used to generate a key .
- Content ID (recommended), which is a value that uniquely identifies the Windows Media file.
- License acquisition URL , which points to the first page in the license acquisition process. This license acquisition URL is used for players that support Windows Media Rights Manager 7 SDK or later.
- Individualization version number (optional), which specifies the minimum version of individualization ( security upgrade ) that a consumer's player must have to play your Windows Media files.
- Attributes (optional), which are name-value pairs defined by the content packager . These attributes enable a content packager to add information to a Windows Media file. For a list of recommended attributes, see Adding Attributes to the Content Header.
Players that support Windows Media Rights Manager 7 SDK or later use the content header information to send a challenge when requesting a license ; however, players that support only version 1 cannot interpret this content header. To make sure that your Windows Media files work with players that support either version 1 or version 7 or later, you can add information to the Windows Media file outside of the content header when you protect the file so that you can issue version 1 licenses (if you do not specify a version 1 license acquisition URL, a default URL is used that points to a page where consumers can download a player that supports version 7 or later). This information is added during the protection stage.
Note Players based on the Windows Media Format 7.1 SDK can read content headers created with Windows Media Rights Manager 10 SDK, although the additional signed information is ignored.
Then, you must sign the content header to increase security and prevent tampering with the packaged Windows Media file. The content header is signed with your private key ; for the license issuer to verify the signature, you must share your public key with the license issuer. Before issuing a license, the license issuer can verify the validity of the signature of the content header by using the content packager's public key. If these signatures do not match, the license is not issued. For example, if someone tried to change the content ID in a Windows Media file, the content header's signature would be damaged, indicating that the Windows Media file was tampered with. The content packager can use the GenerateSigningKeys method of the WMRMKeys object to generate the private and public key pair. The WMRMHeader object is used to create and sign the content header.
Once the content header is signed, take the string from the Header property in the WMRMHeader object and set it in the Header property in the WMRMProtect object.
Note You should only use the Windows Media Rights Manager objects to create and modify content headers.
The following Visual Basic Scripting Edition (VBScript) code example shows how to create a content header.
VBScript Example
HeaderObj.KeyID = key_id
HeaderObj.LicenseAcqURL = laurl
HeaderObj.ContentID = content_id
HeaderObj.IndividualizedVersion = indiv_version
' The following attributes are recommended.
HeaderObj.Attribute("Copyright") = "copyright statement"
HeaderObj.Attribute("ContentType") = "audio or video"
HeaderObj.Attribute("Author") = "artist name"
HeaderObj.Attribute("ArtistURL") = "https://artist_web_site"
HeaderObj.Attribute("Title") = "title"
HeaderObj.Attribute("LicenseDistributor") = "name of license issuer"
HeaderObj.Attribute("LicenseDistributorURL") = "https://license_issuer_web_site"
HeaderObj.Attribute("ContentDistributor") = "content distributor"
HeaderObj.Attribute("Rating") = "rating"
HeaderObj.Attribute("Description") = "description"
call HeaderObj.SetCheckSum(key)
call HeaderObj.Sign(privatekey)
header = HeaderObj.Header
ProtectObj.Header = header
See Also