Windows Media Rights Manager SDK banner art

WMRMLicGen.Attribute

The Attribute property specifies and retrieves name-value pairs in a license. This property lets you add metadata to licenses, which can be used in the future for features in a player application. For example, players could display license information to consumers.

Syntax

WMRMLicGen.Attribute(bstrName) = String
String = WMRMLicGen.Attribute(bstrName)

Parameters

bstrName

[in] String containing the attribute name. It is strongly recommended that you use the names in the following table.

Value Description
ArtistURL Contains the URL of the artist's Web site.
Author Contains the name of the content author.
ContentDistributor Contains the name of the distributor of the content.
ContentType Contains the type of content, such as music or video.
Copyright Contains the copyright of the content.
Description Contains a description of the content.
LGPUBKEY License revocation public key
LicenseDistributor Contains the name of the license distributor.
LicenseDistributorURL Contains the URL of the license issuer's Web site.
Rating Contains the rating indicating the type of audience for which the content is suitable.
Title Name of the content.
UID User ID

Return Values

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

Return code Description
0x80048001 A parameter is not valid.
0x80048003 The object cannot be initialized.
0x80048010 The attribute cannot be set.

Remarks

Attributes do not affect the way a license is used on the client computer. Attribute names are case-sensitive, and both the name and value must be specified in a valid XML format. If you duplicate an existing attribute, the earlier attribute is updated.

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 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

' 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.AllowPlay = 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.
          ' If varVersion is 513, then this is the v7 or later client.
      case 1
          ' Client is individualized.
          ' If varVersion is 514, then this is the v9 client (security version 2.2).
          ' If varVersion is 515, then this is the v10 beta client (security version 2.3).
          ' If varVersion is 516, then this is the v10 client (security version 2.4).
      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)

' Create a license.

    sLicense = LicGen.GetLicenseToDeliver()

' Add this license to the license response.

    ResponseObj.AddLicense("2.0.0.0", sLicense)

' 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