Share via


Generating Key IDs, Keys, and Content IDs

banner art

Previous Next

Generating Key IDs, Keys, and Content IDs

The first step in packaging a Windows Media file is to generate the following values for it:

  • A key ID, which is a string used to generate the key . The key ID is stored in content header of the Windows Media file, and is used later by Windows Media License Service to generate a key and license for the Windows Media file.

    The key ID can also be specified rather than generated. For example, you can use the key ID that was generated for a different Windows Media file if you want both Windows Media files to be locked with the same key.

  • A content ID, which is a value that uniquely identifies the Windows Media file. You should use the WMRMKeys object to generate a content ID. While a content ID is not required, it is strongly recommended that you specify one.

  • A key, which is used to lock the Windows Media file.

Use the WMRMKeys object to generate the key ID and optionally the content ID. Then, with the key ID and license key seed , you can use the WMRMKeys object to generate the key for the Windows Media file, as shown in the following Visual Basic Scripting Edition (VBScript) code example.

Note   Although it is possible to use custom key IDs, issues may arise on the client for various reasons, such as if the custom value is too short, if it includes nonstandard characters, or if it is not base64-encoded. These issues can be avoided by generating key IDs using WMRMKeys.GenerateKeyID.

VBScript Example

KeysObj.seed = your_license_key_seed
key_id = KeysObj.GenerateKeyID()
content_id = KeysObj.GenerateKeyID()
KeysObj.KeyID = key_id
key = KeysObj.GenerateKey()

See Also

Previous Next

© 2007 Microsoft Corporation. All rights reserved.