Share via


Windows Media Rights Manager SDK banner art

WMRMHeader.Attribute

The Attribute property specifies and retrieves name-value pairs.

Syntax

WMRMHeader.Attribute(bstrName) = String
String = WMRMHeader.Attribute(bstrName)

Parameters

bstrName

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

Attribute name 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.
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.

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
0x80004005 An unspecified error occurred.
0x80070057 The specified parameter is not valid.
0x80041003 The string was not specified in a valid XML format.

Remarks

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

' Declare variables and objects.

    Dim sKID, sCID, sSeed, sKey, sHeader
    Dim sPrivKey, sPubKey
    Dim HeaderObj
    Dim KeysObj
    Dim ProtectObj

' Create objects.

    Set HeaderObj = Server.CreateObject("Wmrmobjs.WMRMHeader")
    Set KeysObj = Server.CreateObject("Wmrmobjs.WMRMKeys")
    Set ProtectObj = Server.CreateObject("Wmrmobjs.WMRMProtect")

' Create the key ID and content ID, and key. Set the key ID and 
' the content ID into the header. Store the key in a secure manner.

    sKID = KeysObj.GenerateKeyID()
    sCID = KeysObj.GenerateKeyID()
    KeysObj.KeyID = sKID

    HeaderObj.KeyID = sKID
    HeaderObj.ContentID = sCID

'  Replace XXX with the license key seed.

    sSeed = "XXX"
    KeysObj.Seed = sSeed

' Generate the key.

    sKey = KeysObj.GenerateKey()

' Require individualization version 2.2.
' Version numbers change. Make sure this is up to date

    HeaderObj.IndividualizedVersion = "2.2"

' Specify the URL of the license issuer, and set it into
' the header.

    sURL = "https://www.LicenseIssuer.com/getlicense.asp"
    HeaderObj.LicenseAcqURL = sURL

' Set name-value pairs describing the content into the header.

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

' Set the checksum.

    HeaderObj.SetCheckSum(sKey)

' Replace XXX with the packaging server's private key. 

    sPrivKey = "XXX"

' Sign the header.

    HeaderObj.Sign(sPrivKey)

' Retrieve the string containing the header.

    sHeader = HeaderObj.Header

' Set the header string into the WMRMProtect object.

    ProtectObj.Header = sHeader

' Set the key into the WMRMProtect object.

    ProtectObj.Key = sKey

' Specify the name of the file to be protected.

    ProtectObj.InputFile = "c:\input_file.wmv"

' Generate a protected file.

    ProtectObj.ProtectFile("c:\output_file_1.wmv")

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