Windows Media Rights Manager SDK banner art


The KeyId property specifies and retrieves the key ID of the license to revoke.


WMRMLicenseRevocationResponse.KeyId=StringString = WMRMLicenseRevocationResponse.KeyId


This property takes no parameters.

Return Values

If the property succeeds, it returns a String containing a key ID. If it fails, it returns a number in the error object.


If you specify a key ID with this property, all licenses with this key ID that also match the other criteria you specify will be deleted.

Example Code

' Declare variables.
Dim LRChallengeObj       ' WMRMLicenseRevocationChallenge object
Dim LRResponseObj        ' WMRMLicenseRevocationResponse object

Dim LRChallString        ' License revocation challenge string
Dim ClientMachineID      ' Value that identifies the client computer
Dim CustomDataArray      ' Array to hold the custom data
Dim CustomDataItem       ' Counter
Dim UIDValue             ' User ID value
Dim KIDValue             ' Key ID value
Dim ChallTransID         ' Transaction ID in the challenge
Dim ClientPubkey         ' Public key of the client computer
Dim CustomDataString     ' Custom data included by the client plug-in
Dim KeyID                ' Key ID identifying the licenses to revoke
Dim LRPubkey             ' Public key for license revocation
Dim LRPrivkey            ' Private key for license revocation
Dim LRResponseString     ' License revocation response string

' Set variables.
LRChallString = "<Replace this with a challenge string>"
LRPubkey = "<Replace this with the license revocation public key>"
LRPrivkey = "<Replace this with the license revocation private key>"

' Set the license revocation challenge into the WMRMLicenseRevocationChallenge object.
' Retrieve the client computer ID, public key, transaction ID, and custom data.
Set LRChallengeObj = Server.CreateObject("WMRMObjs.WMRMLicenseRevocationChallenge")
Call LRChallengeObj.Initialize(LRChallString)
ClientMachineID = LRChallengeObj.GetMachineId
ChallTransID = LRChallengeObj.GetTransactionId
ClientPubkey = LRChallengeObj.GetMachinePublicKey

' B64Decode is a custom function to decode the base64-encoded string.
CustomDataString = B64Decode(LRChallengeObj.GetCustomData())

' Create the license revocation response. 
Set LRResponseObj = Server.CreateObject("WMRMObjs.WMRMLicenseRevocationResponse")

' Process your custom data and follow your business logic 
' to determine which licenses to delete. 
' In this sample, assume the custom data specified a user ID
' (UID) of 123 and a key ID (KID) of 456; the custom data string
' would be "UID=123;KID=456;"
' So, in this sample, if a user ID is present, set it into
' the CustomData property. 
' If a key ID is present, set it into the KeyId property. 
' If both values are specified, only licenses with both
' values will be revoked.
CustomDataArray = Split(CustomDataString, ";")
For Each CustomDataItem in CustomDataArray
    If InStr(CustomDataItem, "UID=") > 0 then      ' Specify a user ID
        UIDValue = right(CustomDataItem, Len(CustomDataItem)-Len("UID:"))
        LRResponseObj.CustomData = UIDValue
    Elseif InStr(CustomDataItem, "KID=") > 0 then  ' Specify a key ID
        KIDValue = right(CustomDataItem, Len(CustomDataItem) - Len("KID:"))
        LRResponseObj.KeyId = KIDValue 
    End If

' Specify the license revocation public key and the transaction ID.
' Generate the license revocation response.
LRResponseObj.RevocationPublicKey = LRPubkey
LRResponseObj.TransactionId = ChallTransID    
LRResponseString = LRResponseObj.GenerateSignedResponse(LRPrivkey, ClientPubkey)


Version: Windows Media Rights Manager 10 SDK or later

Reference: wmrmobjs 1.0 Type Library

Library: wmrmobjs.dll

Platform: Windows Server 2003

See Also