Condividi tramite


WMRMResponse.AddRevocationData

banner art

Previous Next

WMRMResponse.AddRevocationData

The AddRevocationData method adds revocation data to a license.

Syntax

  WMRMResponse
  .AddRevocationData(
  bstrRevInfo
  , 
  bstrSupportedCRLS
  , 
  fRevInfoPresent
  )

Parameters

bstrRevInfo

[in] String retrieved from WMRMChallenge.RevInfo containing the revocation information.

bstrSupportedCRLS

[in] String retrieved from WMRMLicGen.SupportedCRLS containing the certificate revocation lists (CRLs) supported by the client.

fRevInfoPresent

[in] Boolean retrieved from WMRMChallenge.RevInfoPresent indicating whether revocation information was included in the license request.

Return Values

If the method succeeds, it returns S_OK. If the method fails, it returns a number in the error object.

Return code Description
0x00000001L There was no revocation data from the client.

Remarks

You must explicitly call this method to add revocation data to the license response. If you do not add this information, an error could be displayed to the end user.

Example Code

' Declare variables and objects.
Dim seed, contentowner_publickey, silent
Dim strLicenseRequested, varHeader
Dim kid, lResult, varKey, sRights
Dim varLicense, LicenseResponse
Dim strRevinfo, ContainsRevinfo, strClientCRLs
Dim ChallengeObj, HeaderObj, KeysObj
Dim RightsObj, LicGenObj, ResponseObj

' Replace XXX with your own values. In real practice, you would
' retrieve these values from a database.
seed = "XXX"  ' License key seed used by the packaging server.
contentowner_publickey = "XXX"  ' Public signing key for the
                                ' packaging server.
' Create objects.
Set ChallengeObj = Server.CreateObject("WMRMobjs.WMRMChallenge")
Set HeaderObj = Server.CreateObject("WMRMobjs.WMRMHeader")
Set KeysObj = Server.CreateObject("WMRMobjs.WMRMKeys")
Set RightsObj = Server.CreateObject("WMRMobjs.WMRMRights")
Set LicGenObj = Server.CreateObject("WMRMobjs.WMRMLicGen")
Set ResponseObj = Server.CreateObject("WMRMobjs.WMRMResponse")

' Find out whether the request is for silent or non-silent delivery.
silent = true
if (request.Form("nonsilent") <> "") then
    silent = false
end if

' Put the license request (challenge) into the Challenge object.
strLicenseRequested = Request.Form("challenge")
ChallengeObj.Challenge = strLicenseRequested
varHeader = ChallengeObj.Header

' Check for revocation information.
strRevinfo = ChallengeObj.RevInfo
ContainsRevinfo = ChallengeObj.RevInfoPresent

' Put the content header into the Header object. 
HeaderObj.Header = varHeader
lResult = HeaderObj.Verify(contentowner_publickey)
if (lResult = 0) then
    ' TODO: Process for a corrupted or modified header.
end if


' Put the required individualization version from the content header 
' into the WMRMLicGen object.
indiversion = HeaderObj.IndividualizedVersion
LicGenObj.IndividualizedVersion = indiversion

' Extract the key ID from the content header. Put the key ID and
' license key seed into the Keys object, and then generate the key.
kid = HeaderObj.KeyID
KeysObj.KeyID = kid
KeysObj.Seed = seed
varKey = KeysObj.GenerateKey()

' Get the certificate revocation lists that are supported by the client.
strClientCRLs = LicGenObj.SupportedCRLS

' Set the rights.
RightsObj.MinimumSecurityLevel = 1000
RightsObj.BeginDate = "#20050101Z #"
RightsObj.ExpirationDate =  "#20051231Z #"
RightsObj.AllowBackupRestore = true
RightsObj.AllowCopy = false
RightsObj.AllowTransferToSDMI = false
RightsObj.AllowTransferToNonSDMI = false
RightsObj.DeleteOnClockRollback = false
RightsObj.DisableOnClockRollback = true
SRights = RightsObj.GetAllRights

' Put the license information into the License Generator object.
' Including the following attributes is recommended.
LicGenObj.KeyID = kid
LicGenObj.SetKey "", varKey
LicGenObj.Rights = sRights
LicGenObj.Priority = 10
LicGenObj.Attribute("Copyright") = "copyright statement"
LicGenObj.Attribute("ContentType") = "audio or video"
LicGenObj.Attribute("Author") = "artist name"
LicGenObj.Attribute("ArtistURL") = "https://artist_web_site"
LicGenObj.Attribute("Title") = "title"
LicGenObj.Attribute("LicenseDistributor") = "license issuer"
LicGenObj.Attribute("LicenseDistributorURL") = "https://license_issuer_web_site"
LicGenObj.Attribute("ContentDistributor") = "content distributor"
LicGenObj.Attribute("Rating") = "rating"
LicGenObj.Attribute("Description") = "description"

' Bind the license to the public key, and then generate the license.
' GetLicenseToDeliver fails if the client has been revoked.
LicGenObj.BindToPubKey = contentowner_publickey
varLicense = LicGenObj.GetLicenseToDeliver()

' Use the Response object to deliver the license and include 
' revocation information as needed. If the client does
' not allow silent license delivery, display a page (Silent_ns.asp)
' saying that a license has been delivered.
call ResponseObj.AddLicense("2.0.0.0", varLicense)
call ResponseObj.AddRevocationData(strRevinfo, strClientCRLs, ContainsRevinfo)

if (silent = true) then
    LicenseResponse = ResponseObj.GetLicenseResponse()
    Response.Write LicenseResponse
else
'  ResponseObj.ReplaceQuotesWith = """"""    ' For VBScript
   ResponseObj.ReplaceQuotesWith = "\"""     ' For JavaScript
   LicenseResponse = ResponseObj.GetLicenseResponse()

Requirements

Version: Windows Media Rights Manager 10.1.1 SDK

Reference: wmrmobjs 1.0 Type Library

Library: wmrmobjs.dll

Platform: Windows Server 2003

See Also

Previous Next

© 2007 Microsoft Corporation. All rights reserved.