Need help porting MS DRM ASP scripts to PHP
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
Need help porting MS DRM ASP scripts to PHP

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> DRM
Author Message
notjoe



Joined: 27 Sep 2005
Posts: 5

Posted: Tue Sep 27, 2005 12:27 am    Post subject: Need help porting MS DRM ASP scripts to PHP Reply with quote

Hello everyone,

My programming skills are in php and i've never coded any ASP. For the past few days i have been grasping what happens in the complex.asp file you get with the SDK along with it's include files.

I have run into a couple of problems that i'm hoping you guys might be able to help me out with.

1) $indiversion = $objHeader->IndividualizedVersion;
The above doesnt seem to work for me and i get no version number and it causes a fatal com_exception error.

2) so i comment that out and moved on. I get the same error when i do
$objLic->Rights=setv2rights;

I know its hard to know without seeing my code so here it is.

Back to top
View user's profile Send private message
notjoe



Joined: 27 Sep 2005
Posts: 5

Posted: Tue Sep 27, 2005 12:29 am    Post subject: Reply with quote

<?

$objChallenge = NEW COM("wmrmobjs.wmrmchallenge");
$objHeader = NEW COM("wmrmobjs.wmrmheader");
$objLic = NEW COM("wmrmobjs.wmrmlicgen");
$objKey = NEW COM("wmrmobjs.wmrmkeys");
$objres = NEW COM("wmrmobjs.WMRMResponse");

define("conpublickey", "contentserverpubkey");
define("seed","myseedkey");
define("siteurl","http://192.168.1.2/samples");
define("ownerid", "Team CMP, LLC");
define("contentserverprivkey","contentserverprikey");
define("strlicenserequested",$_POST["challenge"]);
$objChallenge->Challenge = strlicenserequested;
define("varclientinfo",$objChallenge->clientinfo);
define("varheader",$objChallenge->Header);
define("v1challenge",$objChallenge->v1challenge);

$objHeader->Header=varheader;
$CID = $objHeader->ContentID;
$res = $objHeader->Verify(conpublickey);
if ($res == 0) {
echo "invalid header";
} else {
echo "Valid Header";
}
define("kid", $objHeader->keyid);
$rid = $objHeader->Attribute("RID");
#$indiversion = $objHeader->IndividualizedVersion;

$objRights = NEW COM("wmrmobjs.wmrmrights");
if ($rid == 1) {
$objRights->MinimumAppSecurity = 500;
$objRights->AllowPlayOnPC = true;
$objRights->AllowBackupRestore = true;
$objRights->AllowTransferToSDMI = true;
$objRights->Playcount = 100;
$objRights->PMRights = 17;
$objRights->PMAppSecurity = 150;
} elseif ($rid == 2) {
$objRights->MinimumAppSecurity = 500;
$objRights->AllowPlayOnPC = true;
$objRights->AllowBackupRestore = true;
$objRights->ExpirationDate = "#20051201Z#";
$objRights->PMRights = 17;
$objRights->PMAppSecurity = 1000;
$objRights->PMExpirationDate = "#20051201Z#";
} elseif ($rid == 3) {
$objRights->MinimumAppSecurity = 500;
$objRights->AllowPlayOnPC = true;
$objRights->AllowBackupRestore = true;
$objRights->AllowTransferToSDMI = true;
$objRights->PMRights = 17;
$objRights->PMAppSecurity = 999;
} elseif ($rid == 4) {
$objRights->MinimumAppSecurity = 500;
$objRights->AllowPlayOnPC = true;
$objRights->Playcount = 2;
$objRights->AllowBackupRestore = true;
} elseif ($rid == 5) {
$objRights->MinimumAppSecurity = 500;
$objRights->AllowPlayOnPC = true;
$objRights->AllowBackupRestore = true;
$objRights->AllowTransferToSDMI = true;
$objRights->PMRights = 17;
$objRights->PMAppSecurity = 1000;
}

define("setv2rights",$objRights->GetAllRights());

$objKey->keyid=kid;
$objKey->seed=seed;
$varkey = $objKey->GenerateKey();


$objLic->keyid=kid;
$objLic->setkey("MSDRM",$varkey);
$objLic->Rights=setv2rights;
$objLic->ClientInfo=varclientinfo;
$objLic->BindToPubKey=conpublickey;
$objLic->Priority=10;




$slicense = $objLic->GetLicenseToDeliver();
$objres->AddLicense("2.0.0.0", $slicense);
$sLicResponse = addslashes($objres->GetLicenseResponse());

include("complex_ns.php");
Back to top
View user's profile Send private message
notjoe



Joined: 27 Sep 2005
Posts: 5

Posted: Tue Sep 27, 2005 12:30 am    Post subject: Reply with quote

Keep in mind this code is very basic as i hoped to get it working before i started looking into building something a little more friendly.

Back to top
View user's profile Send private message
notjoe



Joined: 27 Sep 2005
Posts: 5

Posted: Wed Sep 28, 2005 5:12 pm    Post subject: Reply with quote

Surely someone can help me?
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> DRM All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB