Share via


Binding to the License

Binding to a license is the key to exercising the rights that the license grants. To bind to a license, call DRMCreateBoundLicense. This call must specify exactly which content key you are trying to retrieve in a license. To see the possible locations of a content key in a license, refer to the diagram in End-User Licenses.

When you bind to a license, specify the following items to bind to:

  • The principal (user)
  • The content ID
  • The rights group (currently only one is available)
  • The rights requested (in a comma-delimited list with no spaces between)

Specifying NULL for the principal or the rights group causes the license to bind to the first item of each type in the license.

When an application calls DRMCreateBoundLicense, the rights management system verifies that the user can exercise the right or rights requested (in the environment supplied), and returns a handle to the license. The license contains only the rights that the user has requested and information pertaining to that user and those rights. If any of the requested rights are not granted, the call fails.

The following example shows how to bind to a specific item in a license, in this case, an item identified by a STOCKID (the exact term used in the license) of 23432.

// DRMID has a constructor defined.
DRMID idResource(L"STOCKID", L"23432");
...
DRMBOUNDLICENSEPARAMS oParams;
...
oParams.idResource = idResource;
...
hr = DRMCreateBoundLicense( 
                       hEnv, 
                       &oParams, 
                       wszEUL, 
                       &hBoundLicense, 
                       NULL);

When binding to a license, it is possible that you will encounter the following complications:

  • If a requested right is denied, binding will fail. When at least one of the rights you request is denied, DRMCreateBoundLicense returns E_DRM_BIND_RIGHT_NOT_GRANTED. It is recommended that you call DRMGetUnboundLicenseand parse the license to determine what rights can be granted. For more information, see Querying Licenses.
  • Information about rights not granted is removed from the bound license.
  • The same right can be granted in multiple rights groups.
  • XrML allows a symmetric content key to be associated with a license, a work, a rights group, or an individual right. If your application determines that the granted rights are not all associated with the same file, you must handle the differences appropriately.
  • You must determine what additional rights to request when requesting the EDIT right. For example, if your application grants the EDIT right to another application, you must identify the additional rights to grant so that the content can be edited. With the EDIT right, the PLAY and VIEW rights are assumed, but you must also decide whether you will allow the user to print, copy, or perform other actions. For more information, see Interpreting XrML Rights
  • The rights you want to request can be distributed among more than one end-user license. If the desired rights are distributed across several licenses, you can bind to each license.
  • Any certificate in a license might require updated revocation lists. If an application calls DRMAcquireLicense to obtain a license, revocation lists will automatically be acquired (but must still be registered with DRMRegisterRevocationList). For more information, see Registering Revocation Lists.

After binding to a license, you will create either an AD RMS decrypting object or an AD RMS encrypting object from a right mentioned in DRMCreateBoundLicense. You may have to bind to more than one right because each right can be associated with a different version of the content. Creating an AD RMS decrypting object is covered in greater depth in Creating an AD RMS Decrypting Object. Creating an AD RMS encrypting object is covered in Encrypting Content by Using AD RMS Functions.

See Also

Interpreting XrML Rights
Exercising Rights
Registering Revocation Lists
Building a Consuming Application

Send comments about this topic to Microsoft

Build date: 3/13/2008