Compartir a través de


LicenseGenerator.IssueLicense

banner art

Previous Next

LicenseGenerator.IssueLicense

The IssueLicense method creates the license from a challenge.

Syntax

  Call
   LicenseGenerator
  .IssueLicense(
    bstrConnectionString,
    bstrLicenseRequest,
    lUserId,
    varContentId,
    varNumDaysToExpiry,
    varRights,
    varMinClientSecurity,
    varLicenseResponse,
 varIssueID
)

Parameters

bstrConnectionString

[in] String containing the database connection string. If a database is not used, the string is empty.

bstrLicenseRequest

[in] String containing the challenge from the consumer's player.

lUserId

[in] Long containing the ID of the consumer to whom the license was issued. This parameter associates a license with a specific registered consumer. If this information is not available, zero (0) is passed.

varContentId

[in] Variant containing the content ID. The parameter can be NULL or any string representing a GUID.

varNumDaysToExpiry

[in] Variant containing the number of days remaining until the license expires. If this field is NULL, the license never expires.

varRights

[in] Variant containing the rights that are allowed for the Windows Media file. Every challenge contains the rights requested by the consumer. Each of the 32 bits in this value represents a right. If the bit is set to 1, the action is permitted. Currently only 2 bits are assigned for the following rights.

Bit Description
1 The Windows Media file can be played on the computer to which the license was issued.
2 The Windows Media file can be transferred to a portable player.

By using this parameter, Windows Media License Service determines how the final rights are formed. If this parameter is NULL, the consumer is given the requested rights. If this parameter is not NULL, it should be an array of 8 items, each ranging from zero (0) through 255. Windows Media License Service converts each item to a byte and uses the first four bytes to mask off rights that should not be given to a consumer. It uses the last four bytes to give any additional rights, even if the client has not requested them. The final rights are determined as follows:

        final rights = (requested rights & 1st 32 bits) | 2nd 32 bits

where & represents the bitwise AND operation, and | represents the bitwise OR ** operation.

varMinClientSecurity

[in] Variant containing the minimum security level that is needed to issue the license. By default, the value is 100. Every application that requests a license (such as Windows Media Player) has a certificate containing the level of security provided by the application. This security level is part of the license request, and is embedded in the challenge blob. The security level is a 4-byte field in which the left-most byte indicates the highest level of security. The ASP page can request a certain minimum level of security to issue the license, which is indicated in this parameter. If the security level of the requested application is lower than the level specified in this parameter, the license object does not issue the license.

varLicenseResponse

[in, out] Variant containing the license blob to be delivered to the consumer's computer. The client can interpret this blob.

varIssueId

[in,out] Variant containing the license issue ID, if a database is used.

Return Values

This method does not return a value.

Remarks

Both the license and the challenge are encrypted, encoded blobs. The IssueLicense method checks the validity of the request by checking the client version number, the validity of the client certificate, and the license request version number. If the request is valid and all other data is available for generating the license (either from the database or the LicenseGenerator.Set method), the IssueLicense method attempts to form the license blob, and return. If a database is used, the IssueLicense method creates an entry to indicate that a license was issued.

If the registry contains the License Service private key, client verification keys, cert1, and cert2, they are loaded when the LicenseGenerator object is created. There is no need to use the Set method. The registry values are used if bstrConnectionString is NULL. However, if a database is used, the corresponding values will override the values loaded from the registry.

Requirements

Version: Windows Media Rights Manager 7 SDK or later

Reference: LicenseServer 1.0 Type Library

Library: licenseserver.dll

Platform: Windows Server 2003

See Also

Previous Next

© 2007 Microsoft Corporation. All rights reserved.