Issuing licenses for Microsoft digital rights management with coldfusion -- Please HE

Discussion in 'Programming' started by nomis, Nov 25, 2006.

  1. #1
    I am Trying to issue licences with coldfusion this is what i have so
    far.. any help would be appreciated.

    I am able to get the licence in the LicenseResponse variable, but i
    dont know how to send it out. I read some stuff about the coldfusion
    Response interface but i just can't seem to get it to work.

    Thanks in advance for any help.

    <cfset contentowner_publickey = "xxx">
    <cfset seed = "xxx">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMChallenge"
    name="ChallengeObj"
    context="local">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMHeader"
    name="HeaderObj"
    context="local">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMKeys"
    name="KeysObj"
    context="local">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMRights"
    name="RightsObj"
    context="local">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMLicGen"
    name="LicGenObj"
    context="local">

    <cfobject type="com"
    action="create"
    class="Wmrmobjs.WMRMResponse"
    name="ResponseObj"
    context="local">

    <cfset strLicenseRequested = #FORM.challenge#>
    <cfset ChallengeObj.Challenge = #strLicenseRequested#>
    <cfset clientinfo = ChallengeObj.ClientInfo>
    <cfset varHeader = ChallengeObj.Header>

    <cfset HeaderObj.Header = #varHeader#>
    <cfset lResult = HeaderObj.Verify(#contentowner_publickey#)>
    <cfif #lResult# EQ 0>
    <cfabort>
    </cfif>

    <!---<cfset indiversion = HeaderObj.IndividualizedVersion()>
    <cfset LicGenObj.IndividualizedVersion = #indiversion#>--->

    <cfset kid = HeaderObj.KeyID>

    <cfset indiVersion = "2.2">

    <cfset KeysObj.KeyID = #kid#>
    <cfset KeysObj.Seed = #seed#>
    <cfset varKey = KeysObj.GenerateKey()>

    <cfset RightsObj.MinimumSecurityLevel = 500>
    <!---<cfset RightsObj.BeginDate = Now()>
    <cfset RightsObj.ExpirationDate = Now()>--->
    <cfset RightsObj.AllowPlayOnPC = true>
    <cfset RightsObj.AllowTransferToSDMI = true>
    <cfset RightsObj.PMRights = 17>
    <cfset RightsObj.PMAppSecurity = 999>
    <cfset RightsObj.AllowBackupRestore = false>
    <cfset RightsObj.AllowCopy = false>
    <cfset RightsObj.DeleteOnClockRollback = false>
    <!---<cfset RightsObj.DisableOnClockRollback = true>--->
    <cfset sRights = RightsObj.GetAllRights()>

    <cfset LicGenObj.KeyID = #varKey#>
    <cfset call = LicGenObj.SetKey("", #varKey#)>
    <cfset call = LicGenObj.Attribute("LICENSESERVER",
    "http://www.myDomain.com")>
    <cfset LicGenObj.Rights = #sRights#>
    <cfset LicGenObj.Priority = 10>
    <cfset LicGenObj.ClientInfo = #clientinfo#>
    <cfset LicGenObj.IndividualizedVersion = #indiVersion#>

    <cfset LicGenObj.BindToPubKey = #contentowner_publickey#>
    <cfset varLicense = LicGenObj.GetLicenseToDeliver()>

    <cfset call = ResponseObj.AddLicense("2.0.0.0", #varLicense#)>

    <cfset LicenseResponse = ResponseObj.GetLicenseResponse()>

    THIS IS NOT CORRECT BUT I THINK IT SHOUDL BE SOMETHING LIKE THIS BELOW
    <cfscript>
    response.write(#LicenseResponse#);
    </cfscript>

    I am able to get the licence in the LicenseResponse variable, but i
    dont know how to send it out. I read some stuff about the coldfusion
    Response interface but i just can't seem to get it to work.

    Thanks in advance for any help.
     
    nomis, Nov 25, 2006 IP