Share via


WMRMLicGen.GetClientVersion

banner art

Previous Next

WMRMLicGen.GetClientVersion

The GetClientVersion method retrieves information about the DRM component running on the consumer's computer.

Syntax

  WMRMLicGen
  .GetClientVersion(
  pvarCategory
  , pvarVersion)

Parameters

pvarCategory

[in, out] The VT_I1 Variant that identifies whether the DRM component on a PC client has been individualized. An even value indicates a default, non-individualized component. An odd value indicates an individualized component.

This value does not determine whether devices have been individualized.

pvarVersion

[in, out] The VT_I2 Variant containing the version number of the DRM component running on the consumer's computer. See Remarks for possible values.

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
0x80048003 Object initialization error.
0x80048005 Client information is not set.

Remarks

The following table lists the possible values of pvarVersion.

Windows Media release Default security version Individualized security version
7.x 513 514
9 Series 515 514
10 (limited beta) 515 515
10 515 516
10.1.1 (Windows Media Center in Windows Vista beta 1) 517 518
10.1.1 (Windows Vista and Windows Vista Beta 2) 517 519
10.1.2 517 519

The version in the license request is in the format a*256 + b (for example, for version 2.2: 2*256 + 2 = 514).

Notes   If a DRM component has been both individualized and upgraded, the security version may have a different value from the table above.

To set, require, and detect individualization versions greater than 2.10 (522), you must use version 10.1.1 or later of the Windows Media Rights Manager SDK.

For the latest individualization version information, see the Microsoft Web site https://licenseserver.windowsmedia.com/.

Example Code

' Assume that the content packager has sent encrypted content and 
' a header to a consumer. The client computer posts a challenge to 
' the license issuer. The challenge contains the header sent by the 
' content packager, actions requested by the client, and information 
' about the client computer. To issue a license, perform the 
' following steps.
'

' Declare variables and objects.

    Dim sHeader, sClientInfo, sPubKey, lResult, dwActionCnt
    Dim sLicRequest, lIndex, sRights, sKeyID, sSeed, sKey 
    Dim varCategory, varVersion, sLicense, sLicResponse
    Dim strRevinfo, ContainsRevinfo, strClientCRLs
    Dim sAction
    Dim HeaderObj
    Dim ChallengeObj
    Dim Rights Obj
    Dim LicGenObj
    Dim ResponseObj

' Create objects.

    Set HeaderObj = Server.CreateObject("Wmrmobjs.WMRMHeader")
    Set ChallengeObj = Server.CreateObject("Wmrmobjs.WMRMChallenge")
    Set RightsObj = Server.CreateObject("Wmrmobjs.WMRMRights")
    Set LicGenObj = Server.CreateObject("Wmrmobjs.WMRMLicGen")
    Set KeysObj = Server.CreateObject("Wmrmobjs.WMRMKeys")
    Set ResponseObj = Server.CreateObject("Wmrmobjs.WMRMResponse")
  
' Retrieve the license request from the client computer.

    sLicRequest = request.Form("challenge")

' Set the license request into the WMRMChallenge object.

    ChallengeObj.Challenge = sLicRequest

' Retrieve the header from the challenge.

    sHeader = ChallengeObj.Header

' Check for revocation information.

    strRevinfo = ChallengeObj.RevInfo
    ContainsRevinfo = ChallengeObj.RevInfoPresent

' Set the header into the WMRMHeader object.

    HeaderObj.Header = sHeader

' Verify the header with the public key created by the content
' packager.

    lResult = HeaderObj.Verify(sPubKey)
    if (lResult = 0) then
        ' The header has been corrupted.
    end if

' Retrieve the client information section of the challenge.

    sClientInfo = ChallengeObj.ClientInfo

' Define the additional rights to be granted to the consumer.

    RightsObj.Reset
    RightsObj.AllowBackupRestore = True
    RightsObj.AllowCopy = False
    RightsObj.BeginDate = "#20050101Z#"
    RightsObj.ExpirationDate = "#20051231Z#"
    RightsObj.DisableOnClockRollback = True
    
' Retrieve the string containing the defined rights, and set 
' the rights into the license.

    sRights = RightsObj.GetAllRights()
    LicGenObj.Rights = sRights

' Set the client information into the license.

    LicGenObj.ClientInfo = sClientInfo

' Check the individualized version of Windows Media Rights Manager
' running on the client computer.

    LicGenObj.GetClientVersion varCategory, varVersion
    Select Case varCategory
      Case 0
          ' Client is not individualized.
      case 1
          ' Client is individualized.
      Case Else
          ' Invalid client category.
    End Select

' Call the BindToPubKey property to send the client a public
' key used to verify the license. When the license contains a 
' public key, Windows Media Rights Manager on the client computer 
' verifies the license. The public key is included in the certificate
' sent to the license issuer by Windows Media License Service.

    LicGenObj.BindToPubKey = sPubKey 

' Set the name of the licensing server into the license.

    LicGenObj.Attribute("Author") = "name of the author"
    LicGenObj.Attribute("ContentDistributor") = "name of the distributor"
    LicGenObj.Attribute("ContentType") = "type of content distributed"
    LicGenObj.Attribute("Title") = "title of the content"

' Set the priority into the license. 

    LicGenObj.Priority = 10

' Retrieve the key ID from the header, and set it into the license.

    sKeyID = HeaderObj.KeyID
    LicGenObj.KeyID = sKeyID

' Use the key ID and your stored license key seed to create the 
' key, and set the key into the license. The license key seed is a
' shared secret between the content packager and the license issuer.

    KeysObj.KeyID = sKeyID
    KeysObj.Seed = sSeed
    sKey = KeysObj.GenerateKey()
    LicGenObj.SetKey("MSDRM", sKey)

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

' Create a license.

    sLicense = LicGen.GetLicenseToDeliver()

' Add this license to the license response.

    Call ResponseObj.AddLicense("2.0.0.0", sLicense)
    Call ResponseObj.AddRevocationData(strRevinfo, strClientCRLs, ContainsRevinfo)

' Retrieve a string containing the license response.

    sLicResponse = Response.GetLicenseResponse()

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

© 2007 Microsoft Corporation. All rights reserved.