<?php

require('xmlseclibs.php');
require(
'icard_managed_lib.php');
include(
"config.php");

$ctype "text/xml";
$file_name "cdatamanaged.crd";            
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Description: Test InfoCard");
    if (
strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) {
        
header("Expires: 0");
        
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        
header("Pragma: public");
    }    

$test = new ICard('urn:06f8cf80-a024-cdat-azonee0b8cfcc2bea'1'http://www.cdatazone.org');

$test->CardName 'CDatazone Managed Demo Card';
$test->setCardImage('cardimg.png''image/png');

/* Do not require the relying party to identity themselves */
// $test->requireRelyingParty(TRUE);

$test->setExpireTime("+1 Year");

$objClaim = new ICardClaimType("http://cdatazone/preference"'preference''Category Preference');
$test->addClaimType($objClaim);

$test->setTokenTypes(array('http://cdatazone.org/preferences'));

/* I dont have a pprivacy notice yet */
// $test->setPrivacyNotice('http://www.cdatazone.org', 1);

$objEndPoint = new ICardEndpoint(CT_SITE_URL.'ip.php'CT_SITE_URL.'mex.php');

$objEndPoint->setIdentityX509(<MY CERT>, TrueTrue);

$objUserCred = new ICardUserCredential(ICardUserCredential::UsernamePasswordCredential'Enter Username and Password');
$objUserCred->setUserName($username);

$objSVC = new ICardTokenService($objEndPoint$objUserCred);
$test->addService($objSVC);


$icard $test->getCard();

$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));
$objKey->loadKey(<MY PRIVATE KEY>, TRUE);

$objDSig = new XMLSecurityDSig();
$objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
$node $objDSig->addObject($test->cardDoc->documentElement);
$objDSig->addReferenceList(array($node), XMLSecurityDSig::SHA1NULLNULL);
$objDSig->sign($objKey);
$objDSig->add509Cert(<MY CERT>, TrueTrue);

print 
$objDSig->sigNode->ownerDocument->saveXML($objDSig->sigNode->ownerDocument->documentElement);
?>