WMRMKeys.GenerateKeyID
Previous | Next |
WMRMKeys.GenerateKeyID
The GenerateKeyID method creates a globally unique key ID.
Syntax
String = WMRMKeys .GenerateKeyID()
Parameters
This method takes no parameters.
Return Values
If the method succeeds, it returns a String containing the base64-encoded key ID. If it fails, it returns a number in the error object.
Return code | Description |
0x80004005 | An unspecified error occurred. |
0x80070057 | The specified parameter is not valid. |
Remarks
The key ID is a globally unique identifier (GUID). The GenerateKeyID method does not change the persistence of the key ID in the WMRMKeys object.
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, and if it is not base64-encoded. These issues can be avoided by generating key IDs using GenerateKeyID.
Example Code
Dim sKID, sCID, sSeed, sKey, sHeader Dim sPrivKey, sPubKey Dim HeaderObj Dim KeysObj Dim ProtectObj ' Create objects. Set HeaderObj = Server.CreateObject("Wmrmobjs.WMRMHeader") Set KeysObj = Server.CreateObject("Wmrmobjs.WMRMKeys") Set ProtectObj = Server.CreateObject("Wmrmobjs.WMRMProtect") ' Require individualization version 2.2. ' Version numbers change. Verify that this number is up to date. .IndividualizedVersion="2.2" HeaderObj.SetCheckSum(sKey) ' Replace XXX with the packaging server's private key. = "XXX" ' Sign the header. ' Retrieve the string containing the header. sHeader = HeaderObj.Header ' Set the header string into the WMRMProtect object. ProtectObj.Header = sHeader ' Set the key into the WMRMProtect object. ProtectObj.Key = sKey ' Specify the name of the file to be protected. ProtectObj.InputFile = "c:\input_file.wmv" ' Generate a protected file. ProtectObj.ProtectFile("c:\output_file_1.wmv")
Requirements
Version: Windows Media Rights Manager 7 SDK or later
Reference: wmrmobjs 1.0 Type Library
Library: wmrmobjs.dll
Platform: Windows Server 2003
See Also
Previous | Next |