
| Path : /home/gujo45me/public_html/farfans/sunat/librerias/robrichards/tests/ |
| Disable Functions : exec,passthru,shell_exec,system System : Linux server-604606.appsiete.com 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 [ Home ][ Zone-h ][ Jumping ][ Symlink ][ Mass Depes ][ Command ] |
| Current File : /home/gujo45me/public_html/farfans/sunat/librerias/robrichards/tests/xmlsec-encrypt.phpt |
--TEST--
Basic Encryption
--FILE--
<?php
require(dirname(__FILE__) . '/../xmlseclibs.php');
use RobRichards\XMLSecLibs\XMLSecurityKey;
use RobRichards\XMLSecLibs\XMLSecEnc;
if (file_exists(dirname(__FILE__) . '/oaep_sha1.xml')) {
unlink(dirname(__FILE__) . '/oaep_sha1.xml');
}
$dom = new DOMDocument();
$dom->load(dirname(__FILE__) . '/basic-doc.xml');
$objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
$objKey->generateSessionKey();
$siteKey = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type'=>'public'));
$siteKey->loadKey(dirname(__FILE__) . '/mycert.pem', TRUE, TRUE);
$enc = new XMLSecEnc();
$enc->setNode($dom->documentElement);
$enc->encryptKey($siteKey, $objKey);
$enc->type = XMLSecEnc::Element;
$encNode = $enc->encryptNode($objKey);
$dom->save(dirname(__FILE__) . '/oaep_sha1.xml');
$root = $dom->documentElement;
echo $root->localName."\n";
unlink(dirname(__FILE__) . '/oaep_sha1.xml');
?>
--EXPECTF--
EncryptedData