PHP Classes

File: dsig.example.php

Recommend this page to a friend!
  Classes of Alexander Kalendarev   XML Security   dsig.example.php   Download  
File: dsig.example.php
Role: Example script
Content type: text/plain
Description: example of using design xml document
Class: XML Security
Encrypt and decrypt XML documents
Author: By
Last change:
Date: 17 years ago
Size: 631 bytes
 

Contents

Class file image Download
<?
include "xmlsec.class.php";


 
$f = fopen( "data.xml" , 'r') ;
  if ( !
$f ){
     echo
'Error open file ';
     exit;
  }

 
$xmlstr = fread($f, filesize("data.xml"));
 
fclose($f);

 
$doc = domxml_open_mem( $xmlstr );

 if ( !
$doc )
  {
      echo
"Error while parsing the input xml document\n";
      exit;
  }

 
$xmlsec = new xmlsec( 'keys.xml' , "/home/akalend/temp");



 
$res = $xmlsec->sign( $doc, XMLSEC_RSA_SHA1 );

// die( $xmlsec->errorMsg );
if ( !$res )
   die(
$xmlsec->errorMsg .'<br>'.$xmlsec->cmd);
 else
 
header('Content-type: text/xml');

PRINT
$res;



?>