Share via


Reusing Issuance License Data

The hBoundLicense parameter allows an application to reuse data from an existing issuance license. This is done by having the publishing application create a VIEWRIGHTSDATA right, and then granting that right to any application allowed to reuse the issuance license information.

To reuse an existing license

  1. Obtain a signed issuance license for which you are granted the VIEWRIGHTSDATA or OWNER right.

  2. Bind to the license by using the DRMCreateBoundLicense function.

  3. Pass the handle to the bound license into hBoundLicense and pass the signed issuance license or template into wszIssuanceLicense to create a new license that reuses data from the old license. The following data is taken from the old license:

The following example shows part of step 2 and step 3. It does not show all the details required to bind to a license (such as creating a client and license storage session). For more information about binding to a license, see Obtaining a Signed Issuance License and Binding to the License. The code also does not check for revocation list errors, which should be done whenever a license is bound. For more information about revocation lists, see Registering Revocation Lists.

...

// wszEULCertificateData is an EUL previously acquired from a 
// signed issuance license.
// wszSignedIssuanceLicense is the signed issuance license 
// used to get the EUL.
// The next steps allow us to bind to the license.

// Obtain the GroupID certificate. 
hr = EnumGIC( hClient, &wszGroupIDCertificateData );
 if(FAILED(hr))
{// Handle error.}

// Create the enabling principal.
hr = DRMCreateEnablingPrincipal (
                     hEnv, // Previously created environment object.
                     hDefaultLibrary,
                     idStandardEP.wszID,
                     &idNULL,
                     wszGroupIDCertificateData,
                     &hEnablingPrincipal );
if(FAILED(hr))
{// Handle error.}

// Set parameters for binding to the license.
 oParams.hEnablingPrincipal                = hEnablingPrincipal;
 oParams.hSecureStore                      = NULL;
 oParams.wszRightsRequested                = L"VIEWRIGHTSDATA";
 oParams.wszRightsGroup                    = NULL; 
 oParams.idResource                        = idContent;
 oParams.wszDefaultEnablingPrincipalCredentials = NULL;
 oParams.cAuthenticatorCount               = 0;

// Bind the acquired license to the VIEWRIGHTSDATA right.
hr = DRMCreateBoundLicense ( hEnv,
                   &oParams,
                   wszEULCertificateData,
                   &hBoundLicense,
                   NULL );

if(FAILED(hr))
{// Check for stale or missing revocation lists here.}

// Create an owner for the new license.
hr = DRMCreateUser( 
          L"user@yourdomain.com", // Replace with a verifiable NTLM 
                                  // or Passport ID. This should 
                                  // match the ID used to create 
                                  // the client session.
           NULL,
           L"WINDOWS",            // Windows or Passport.
           &hOwner);

// Finally, create a new issuance license from 
// the signed issuance license.
 hr = DRMCreateIssuanceLicense( 
                             &stFrom,
                             &stUntil,
                             NULL,
                             NULL,
                             hOwner,
                             wszSignedIssuanceLicense,
                             hBoundLicense,
                             &hNewIssuanceLicense);
if(FAILED(hr))
{// Handle error.}
...

See Also

Building a Publishing Application
Creating an Issuance License
Creating an Issuance License From a Template
Creating an Issuance License From Scratch
Licenses and Certificates
Building a Publishing Application

Send comments about this topic to Microsoft

Build date: 3/13/2008