Windows Media Rights Manager SDK banner art

WMRMLicenseRevocationResponse.RevocationPublicKey

The RevocationPublicKey property specifies and retrieves the public key for license revocation.

Syntax

WMRMLicenseRevocationResponse.RevocationPublicKey=StringString = WMRMLicenseRevocationResponse.RevocationPublicKey

Parameters

This property takes no parameters.

Return Values

If the property succeeds, it returns a String containing the private key of the license issuer. If it fails, it returns a number in the error object.

Remarks

The license issuer creates a public-private key pair using the WMRMKeys.GenerateSigningKeys method when setting up a license revocation process. Then, this public key must be added to licenses as an attribute by using the WMRMLicGen.Attribute property as follows:

WMRMLicGen.Attribute("LGPUBKEY") = YourLicenseRevocationPublicKey

Only licenses with this attribute can be revoked, ensuring that a licensing server can revoke only its own licenses.

The private key is used to ensure secure communications; the license revocation response is signed with this private key. The client verifies the signature using this public key.

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
Next

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' 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)

Requirements

Version: Windows Media Rights Manager 10 SDK or later

Reference: wmrmobjs 1.0 Type Library

Library: wmrmobjs.dll

Platform: Windows Server 2003

See Also