PHP Classes

File: verify.example.php

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

Contents

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

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

 
$xmlstr = fread($f, filesize("dsig.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' , // keys file
 
"/home/akalend/temp", // temp writeable directory if undefined in $TMPDIIR in ENV
  
true); // false for debugging - save temp files ( define is true )
 
 
$res = $xmlsec->verify( $doc );

 
 if (
$res )
   print
'the sign verify';
   else
   die(
'msg: '.$xmlsec->errorMsg .'<br> cmd:'.$xmlsec->cmd);
 
?>