Generating a License for Metered Content
After receiving a metering certificate from a metering aggregation service, a license issuer generates a license for metered content as follows:
- When a license request is received for metered content, the license issuer uses the WMRMLicGen.MeteringCertificate property to specify which metering certificate to use.
- The corresponding metering ID and URL are then added to the license, and all actions for the corresponding content will be metered.
Example Code
' Declare variables.
Dim LicenseObj ' WMRMLicGen object
Dim MeterCert ' Metering certificate
Dim LicenseKID ' Key ID
Dim LicenseKey ' Key
Dim RightsString ' Rights string
Dim varClientInfo ' Client information
Dim ContentServerPubKey ' Public key of the content server
Dim IndiVersion ' Security version of the DRM component
Dim varLicense ' License
' Specify your metering certificate (XML string).
' The following is a sample metering certificate.
' VBScript requires you to use double quotes for quotes within the string.
MeterCert = "<METERCERT version=""1.0""><DATA><MID>pIKx8Wsy5aYRQN8LLIIcTQ==</MID><PUBLICKEY>nm0yQ6CXLcQIBf*Zc*VKGL!SziEdTT!ehGxDotUazwFtE7X40IlqAQ==</PUBLICKEY><URL>https://www.MyMeteringService.com</DATA><CERTIFICATECHAIN><CERTIFICATE>AAEAADgAAAB17bfg!cqDLB2clHGU7P6zkrOCVUddX95UYkqpjqvoIr4ezqw2zgwfrvKR1dq!EzdGD8ND2Ihkn0OPEoWZZKCwgidp7Y5SHR!NFJJazdPWfBQEBB4AAAABAAAAAQAAAAE=</CERTIFICATE></CERTIFICATECHAIN><SIGNATURE><HASHALGORITHM type=""SHA""></HASHALGORITHM><SIGNALGORITHM type=""MSDRM""></SIGNALGORITHM><VALUE>dvVMtj5p9o7I5IK2XIYwkQoF1Rli4cgpS1UkCjBx8KIr7SrPE9!0Vg==</VALUE></SIGNATURE></METERCERT>"
' Generate the license.
Set LicenseObj = Server.CreateObject("WMRMObjs.WMRMlicgen")
LicenseObj.KeyID = LicenseKID
LicenseObj.SetKey "", LicenseKey
LicenseObj.Priority = 10
LicenseObj.Rights = RightsString
LicenseObj.ClientInfo = varClientInfo
LicenseObj.BindToPubKey = ContentServerPubKey
LicenseObj.MeteringCertificate = MeterCert
LicenseObj.IndividualizedVersion = IndiVersion
varLicense = LicenseObj.GetLicenseToDeliver()
See Also