Comming ucUs SH3LL V.2

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 ]

File Upload :
Current File : /home/gujo45me/public_html/farfans/sunat/librerias/robrichards/tests/encrypteddata-node-order.phpt

--TEST--
Test node order of EncryptedData children.
--DESCRIPTION--
Makes sure that the child elements of EncryptedData appear in
the correct order.
--FILE--
<?php
require(dirname(__FILE__) . '/../xmlseclibs.php');
use RobRichards\XMLSecLibs\XMLSecurityKey;
use RobRichards\XMLSecLibs\XMLSecEnc;

$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::Content;
$encNode = $enc->encryptNode($objKey);

$nodeOrder = array(
	'EncryptionMethod',
	'KeyInfo',
	'CipherData',
	'EncryptionProperties',
);

$prevNode = 0;
for ($node = $encNode->firstChild; $node !== NULL; $node = $node->nextSibling) {
	if (! ($node instanceof DOMElement)) {
		/* Skip comment and text nodes. */
		continue;
	}

	$name = $node->localName;

	$cIndex = array_search($name, $nodeOrder, TRUE);
	if ($cIndex === FALSE) {
		die("Unknown node: $name");
	}

	if ($cIndex >= $prevNode) {
		/* In correct order. */
		$prevNode = $cIndex;
		continue;
	}

	$prevName = $nodeOrder[$prevNode];
	die("Incorrect order: $name must appear before $prevName");
}

echo("OK\n");

?>
--EXPECTF--
OK

Copyright © 2019 | Powered By MecUs7