Partager via


WMRM_LICENSE_STATE_CATEGORY

banner art

Previous Next

WMRM_LICENSE_STATE_CATEGORY

The WMRM_LICENSE_STATE_CATEGORY enumeration type defines the state of existing licenses for a content item.

Syntax

  typedef enum WMRM_LICENSE_STATE_CATEGORY{
    WMRM_LICENSE_STATE_NORIGHT = 0,
    WMRM_LICENSE_STATE_UNLIM = 1,
    WMRM_LICENSE_STATE_COUNT = 2,
    WMRM_LICENSE_STATE_FROM = 3,
    WMRM_LICENSE_STATE_UNTIL = 4,
    WMRM_LICENSE_STATE_FROM_UNTIL = 5,
    WMRM_LICENSE_STATE_COUNT_FROM = 6,
    WMRM_LICENSE_STATE_COUNT_UNTIL = 7,
    WMRM_LICENSE_STATE_COUNT_FROM_UNTIL = 8,
    WMRM_LICENSE_STATE_EXPIRATION_AFTER_FIRSTUSE = 9
};

Members

WMRM_LICENSE_STATE_NORIGHT

The license does not allow rights to perform this action, or a license does not exist.

WMRM_LICENSE_STATE_UNLIM

The license allows unlimited rights to perform this action.

WMRM_LICENSE_STATE_COUNT

This action can be performed a certain number of times. Use the WMRMLicenseStateData.Counts property to retrieve that value.

WMRM_LICENSE_STATE_FROM

This action cannot be performed until a specific date. Use the WMRMLicenseStateData.Dates property to retrieve the date.

WMRM_LICENSE_STATE_UNTIL

This action cannot be performed after a certain date. Use the WMRMLicenseStateData.Dates property to retrieve the date.

WMRM_LICENSE_STATE_FROM_UNTIL

This action can be performed only within a specific range of dates. Use the WMRMLicenseStateData.Dates property to retrieve an array containing the start and end dates.

WMRM_LICENSE_STATE_COUNT_FROM

This action can be performed only a certain number of times, starting from a specific date. Use the WMRMLicenseStateData.Counts and WMRMLicenseStateData.Dates properties to retrieve those values.

WMRM_LICENSE_STATE_COUNT_UNTIL

This action can be performed a certain number of times until a specific date. Use the WMRMLicenseStateData.Counts and WMRMLicenseStateData.Dates properties to retrieve those values.

WMRM_LICENSE_STATE_COUNT_FROM_UNTIL

This action can be performed only a certain number of times within a specific range of dates. Use the WMRMLicenseStateData.Counts and WMRMLicenseStateData.Dates properties to retrieve those values.

WMRM_LICENSE_STATE_EXPIRATION_AFTER_FIRSTUSE

License restrictions do not begin until after the first use of the content.

If the license has not been used, use the WMRMLicenseStateData.Counts property to retrieve the number hours after which the license will expire (after it is first used). If the license has been used, use the WMRMLicenseStateData.Dates property to retrieve the expiration date.

Example Code

' Declare variables.
    Dim ChallengeObj             ' WMRMChallenge object
    Dim ChainCollObj             ' WMRMUplinkCollection object
    Dim ChainObj                 ' WMRMUplink object
    Dim LeafLicenseStateObj      ' WMRMLicenseStateData object
    Dim RootLicenseStateObj      ' WMRMLicenseStateData object
    Dim HeaderObj                ' WMRMHeader object

    Dim ContentServerPubKey      ' Public key of the content server
    Dim Seed                     ' License key seed
    Dim LicChain                 ' License chain flag
    Dim strLicenseRequested      ' License request string
    Dim varClientInfo            ' Client information
    Dim varHeader                ' Content header
    Dim blnResult                ' Signature verification
    Dim SimpleLeafKID            ' Key ID of a simple license or leaf license
    Dim IndiVersion              ' Security version of the DRM component
    Dim strRevinfo               ' Revocation information string
    Dim ContainsRevinfo          ' Flag for revocation information
    Dim strClientCRLs            ' Supported revocation lists string

    Dim RootKID                  ' Key ID of the root license
    Dim RootCat                  ' License state data for root licenses
    Dim RCountArray              ' Count array
    Dim RDateArray               ' Date array
    Dim RStreamID                ' Stream ID
    Dim RVague                   ' Vagueness
    Dim IssueRoot                ' Root license flag
    Dim Rcounts                  ' Remaining counts
    Dim RstartDate               ' Start date
    Dim RExpDate                 ' Expiration date

    Dim LeafCat                  ' License state data for leaf licenses
    Dim LCountArray              ' Count array
    Dim LDateArray               ' Date array
    Dim LStreamID                ' Stream ID
    Dim LVague                   ' Vagueness
    Dim IssueLeaf                ' Leaf license flag
    Dim Lcounts                  ' Remaining counts
    Dim LstartDate               ' Start date
    Dim LExpDate                 ' Expiration date

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Set variables.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    ContentServerPubKey = Application("contentserverpubkey")
    Seed = Application("seed")
    LicChain = ""

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Retrieve the license request. Get the client information and content header.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set ChallengeObj = Server.CreateObject("WMRMObjs.WMRMchallenge")
    strLicenseRequested = Request.Form("challenge")
    ChallengeObj.Challenge = strLicenseRequested
    varClientInfo = ChallengeObj.ClientInfo
    varHeader = ChallengeObj.Header

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

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Put the content header into the header object. Retrieve
' the KID and required individualization version.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set HeaderObj = Server.CreateObject("WMRMObjs.WMRMheader")
    HeaderObj.Header = varHeader
    blnResult = HeaderObj.Verify(ContentServerPubKey)
    SimpleLeafKID = HeaderObj.KeyID
    IndiVersion = HeaderObj.IndividualizedVersion
        ' If IndividualizedVersion is not specified, an error 
        ' might be set.

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' If this is a chained license, retrieve the root license KID.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set ChainCollObj = ChallengeObj.Uplinks
    If (Err.Number = 0) Then    ' Request for a license chain. 
        LicChain = "chain"     

        ' Get license state data and key ID for the root license.
        Set ChainObj = ChainCollObj.item(1)
        RootKID =  ChainObj.KID

        ' Get license state data to determine whether to issue
        ' a root license.
        Set RootLicenseStateObj = ChainObj.LicenseState
        RootCat = cstr(RootLicenseStateObj.Category)
        Select Case RootCat
            case 0    ' The root license has no rights.
                IssueRoot = True
            case 1    ' The root license has unlimited play counts.
                IssueRoot = False
            case 2    ' The root license has remaining play counts.
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 3    ' The root license has a start date.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                IssueRoot = False
            case 4    ' The root license has an expiration date.
                RDateArray = RootLicenseStateObj.Dates
                RExpDate =  cstr(RDateArray(0))
                IssueRoot = False
            case 5    ' The root license has start and expiration dates.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RExpDate =  cstr(RDateArray(1))
                IssueRoot = False
            case 6    ' The root license has a start date and 
                      ' remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 7    ' The root license has an expiration date and 
                      ' remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RExpDate =  cstr(RDateArray(0))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 8    ' The root license has start and expiration 
                      ' dates, and remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RExpDate =  cstr(RDateArray(1))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 9    ' The root license expires after first use.
                      ' Add logic to evaluate whether to issue the license.
                IssueRoot = False
        End Select

        RStreamID = RootLicenseStateObj.StreamID  ' This value is always 0.
        RVague = RootLicenseStateObj.Vagueness

        ' Get license state data to determine whether to issue
        ' a leaf license.
        Set ChainObj = ChainCollObj.item(0)
        Set LeafLicenseStateObj = ChainObj.LicenseState
        LeafCat = cstr(LeafLicenseStateObj.Category)
        Select Case LeafCat
            case 0    ' The leaf license has no rights.
                IssueLeaf = True
            case 1    ' The leaf license has unlimited play counts.
                IssueLeaf = False
            case 2    ' The leaf license has remaining play counts.
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 3    ' The leaf license has a start date.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                IssueLeaf = False
            case 4    ' The leaf license has an expiration date.
                LDateArray = LeafLicenseStateObj.Dates
                LExpDate =  cstr(LDateArray(0))
                IssueLeaf = False
            case 5    ' The leaf license has start and expiration dates.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LExpDate =  cstr(LDateArray(1))
                IssueLeaf = False
            case 6    ' The leaf license has a start date and 
                      ' remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 7    ' The leaf license has an expiration date and 
                      ' remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LExpDate =  cstr(LDateArray(0))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 8    ' The leaf license has start and expiration 
                      ' dates, and remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LExpDate =  cstr(LDateArray(1))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 9    ' The root license expires after first use.
                IssueLeaf = False
        End Select

        LStreamID = LeafLicenseStateObj.StreamID  ' This value is always 0.
        LVague = LeafLicenseStateObj.Vagueness

    Else    ' An error indicates a request for a simple license.
        err.clear
        LicChain = "simple"
    End If

' Continue generating the license. 

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

Previous Next

© 2007 Microsoft Corporation. All rights reserved.