Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace RobRichards\XMLSecLibs; use DOMDocument; use DOMElement; use DOM..
Decoded Output download
<?php
namespace RobRichards\XMLSecLibs;
use DOMDocument;
use DOMElement;
use DOMNode;
use DOMXPath;
use Exception;
use RobRichards\XMLSecLibs\Utils\XPath as XPath;
class XMLSecEnc
{
const template = "<xenc:EncryptedData xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'>
<xenc:CipherData>\xd
<xenc:CipherValue></xenc:CipherValue>
\xa </xenc:CipherData>
</xenc:EncryptedData>";
const Element = "http://www.w3.org/2001/04/xmlenc#Element";
const Content = "http://www.w3.org/2001/04/xmlenc#Content";
const URI = 3;
const XMLENCNS = "http://www.w3.org/2001/04/xmlenc#";
private $encdoc = null;
private $rawNode = null;
public $type = null;
public $encKey = null;
private $references = array();
public function __construct()
{
$this->_resetTemplate();
}
private function _resetTemplate()
{
$this->encdoc = new DOMDocument();
$this->encdoc->loadXML(self::template);
}
public function addReference($rU, $xV, $f0)
{
if ($xV instanceof DOMNode) {
goto gP;
}
throw new Exception("$node is not of type DOMNode");
gP:
$uo = $this->encdoc;
$this->_resetTemplate();
$RF = $this->encdoc;
$this->encdoc = $uo;
$OF = XMLSecurityDSig::generateGUID();
$vM = $RF->documentElement;
$vM->setAttribute("Id", $OF);
$this->references[$rU] = array("node" => $xV, "type" => $f0, "encnode" => $RF, "refuri" => $OF);
}
public function setNode($xV)
{
$this->rawNode = $xV;
}
public function encryptNode($ZA, $G0 = true)
{
$x4 = '';
if (!empty($this->rawNode)) {
goto tW;
}
throw new Exception("Node to encrypt has not been set");
tW:
if ($ZA instanceof XMLSecurityKey) {
goto Kx;
}
throw new Exception("Invalid Key");
Kx:
$hU = $this->rawNode->ownerDocument;
$p2 = new DOMXPath($this->encdoc);
$Pr = $p2->query("/xenc:EncryptedData/xenc:CipherData/xenc:CipherValue");
$ox = $Pr->item(0);
if (!($ox == null)) {
goto hb;
}
throw new Exception("Error locating CipherValue element within template");
hb:
switch ($this->type) {
case self::Element:
$x4 = $hU->saveXML($this->rawNode);
$this->encdoc->documentElement->setAttribute("Type", self::Element);
goto e8;
case self::Content:
$bB = $this->rawNode->childNodes;
foreach ($bB as $By) {
$x4 .= $hU->saveXML($By);
vW:
}
rg:
$this->encdoc->documentElement->setAttribute("Type", self::Content);
goto e8;
default:
throw new Exception("Type is currently not supported");
}
Bs:
e8:
$MS = $this->encdoc->documentElement->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptionMethod"));
$MS->setAttribute("Algorithm", $ZA->getAlgorithm());
$ox->parentNode->parentNode->insertBefore($MS, $ox->parentNode->parentNode->firstChild);
$hL = base64_encode($ZA->encryptData($x4));
$tp = $this->encdoc->createTextNode($hL);
$ox->appendChild($tp);
if ($G0) {
goto TP;
}
return $this->encdoc->documentElement;
goto F8;
TP:
switch ($this->type) {
case self::Element:
if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
goto OE;
}
return $this->encdoc;
OE:
$b0 = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
$this->rawNode->parentNode->replaceChild($b0, $this->rawNode);
return $b0;
case self::Content:
$b0 = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
JL:
if (!$this->rawNode->firstChild) {
goto pp;
}
$this->rawNode->removeChild($this->rawNode->firstChild);
goto JL;
pp:
$this->rawNode->appendChild($b0);
return $b0;
}
i0:
RE:
F8:
}
public function encryptReferences($ZA)
{
$rz = $this->rawNode;
$zw = $this->type;
foreach ($this->references as $rU => $Yu) {
$this->encdoc = $Yu["encnode"];
$this->rawNode = $Yu["node"];
$this->type = $Yu["type"];
try {
$DA = $this->encryptNode($ZA);
$this->references[$rU]["encnode"] = $DA;
} catch (Exception $u6) {
$this->rawNode = $rz;
$this->type = $zw;
throw $u6;
}
BM:
}
J3:
$this->rawNode = $rz;
$this->type = $zw;
}
public function getCipherValue()
{
if (!empty($this->rawNode)) {
goto gs;
}
throw new Exception("Node to decrypt has not been set");
gs:
$hU = $this->rawNode->ownerDocument;
$p2 = new DOMXPath($hU);
$p2->registerNamespace("xmlencr", self::XMLENCNS);
$oK = "./xmlencr:CipherData/xmlencr:CipherValue";
$Nw = $p2->query($oK, $this->rawNode);
$xV = $Nw->item(0);
if ($xV) {
goto k7;
}
return null;
k7:
return base64_decode($xV->nodeValue);
}
public function decryptNode($ZA, $G0 = true)
{
if ($ZA instanceof XMLSecurityKey) {
goto ni;
}
throw new Exception("Invalid Key");
ni:
$F_ = $this->getCipherValue();
if ($F_) {
goto aJ;
}
throw new Exception("Cannot locate encrypted data");
goto FI;
aJ:
$Er = $ZA->decryptData($F_);
if ($G0) {
goto wL;
}
return $Er;
goto lM;
wL:
switch ($this->type) {
case self::Element:
$rK = new DOMDocument();
$rK->loadXML($Er);
if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
goto ej;
}
return $rK;
ej:
$b0 = $this->rawNode->ownerDocument->importNode($rK->documentElement, true);
$this->rawNode->parentNode->replaceChild($b0, $this->rawNode);
return $b0;
case self::Content:
if ($this->rawNode->nodeType == XML_DOCUMENT_NODE) {
goto jh;
}
$hU = $this->rawNode->ownerDocument;
goto yk;
jh:
$hU = $this->rawNode;
yk:
$Kn = $hU->createDocumentFragment();
$Kn->appendXML($Er);
$cr = $this->rawNode->parentNode;
$cr->replaceChild($Kn, $this->rawNode);
return $cr;
default:
return $Er;
}
nU:
H_:
lM:
FI:
}
public function encryptKey($je, $nj, $lY = true)
{
if (!(!$je instanceof XMLSecurityKey || !$nj instanceof XMLSecurityKey)) {
goto gS;
}
throw new Exception("Invalid Key");
gS:
$BD = base64_encode($je->encryptData($nj->key));
$Z9 = $this->encdoc->documentElement;
$XD = $this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptedKey");
if ($lY) {
goto Xk;
}
$this->encKey = $XD;
goto Th;
Xk:
$um = $Z9->insertBefore($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyInfo"), $Z9->firstChild);
$um->appendChild($XD);
Th:
$MS = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptionMethod"));
$MS->setAttribute("Algorithm", $je->getAlgorith());
if (empty($je->name)) {
goto SD;
}
$um = $XD->appendChild($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyInfo"));
$um->appendChild($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyName", $je->name));
SD:
$yV = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:CipherData"));
$yV->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:CipherValue", $BD));
if (!(is_array($this->references) && count($this->references) > 0)) {
goto Qa;
}
$v4 = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:ReferenceList"));
foreach ($this->references as $rU => $Yu) {
$OF = $Yu["refuri"];
$QT = $v4->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:DataReference"));
$QT->setAttribute("URI", "#" . $OF);
gM:
}
l_:
Qa:
return;
}
public function decryptKey($XD)
{
if ($XD->isEncrypted) {
goto ZA;
}
throw new Exception("Key is not Encrypted");
ZA:
if (!empty($XD->key)) {
goto TF;
}
throw new Exception("Key is missing data to perform the decryption");
TF:
return $this->decryptNode($XD, false);
}
public function locateEncryptedData($vM)
{
if ($vM instanceof DOMDocument) {
goto Xd;
}
$hU = $vM->ownerDocument;
goto rF;
Xd:
$hU = $vM;
rF:
if (!$hU) {
goto FX;
}
$J9 = new DOMXPath($hU);
$oK = "//*[local-name()='EncryptedData' and namespace-uri()='" . self::XMLENCNS . "']";
$Nw = $J9->query($oK);
return $Nw->item(0);
FX:
return null;
}
public function locateKey($xV = null)
{
if (!empty($xV)) {
goto MA;
}
$xV = $this->rawNode;
MA:
if ($xV instanceof DOMNode) {
goto j1;
}
return null;
j1:
if (!($hU = $xV->ownerDocument)) {
goto Li;
}
$J9 = new DOMXPath($hU);
$J9->registerNamespace("xmlsecenc", self::XMLENCNS);
$oK = ".//xmlsecenc:EncryptionMethod";
$Nw = $J9->query($oK, $xV);
if (!($XZ = $Nw->item(0))) {
goto nC;
}
$Bl = $XZ->getAttribute("Algorithm");
try {
$ZA = new XMLSecurityKey($Bl, array("type" => "private"));
} catch (Exception $u6) {
return null;
}
return $ZA;
nC:
Li:
return null;
}
public static function staticLocateKeyInfo($gY = null, $xV = null)
{
if (!(empty($xV) || !$xV instanceof DOMNode)) {
goto EF;
}
return null;
EF:
$hU = $xV->ownerDocument;
if ($hU) {
goto iZ;
}
return null;
iZ:
$J9 = new DOMXPath($hU);
$J9->registerNamespace("xmlsecenc", self::XMLENCNS);
$J9->registerNamespace("xmlsecdsig", XMLSecurityDSig::XMLDSIGNS);
$oK = "./xmlsecdsig:KeyInfo";
$Nw = $J9->query($oK, $xV);
$XZ = $Nw->item(0);
if ($XZ) {
goto Cy;
}
return $gY;
Cy:
foreach ($XZ->childNodes as $By) {
switch ($By->localName) {
case "KeyName":
if (empty($gY)) {
goto KU;
}
$gY->name = $By->nodeValue;
KU:
goto gL;
case "KeyValue":
foreach ($By->childNodes as $pK) {
switch ($pK->localName) {
case "DSAKeyValue":
throw new Exception("DSAKeyValue currently not supported");
case "RSAKeyValue":
$Gj = null;
$a1 = null;
if (!($JN = $pK->getElementsByTagName("Modulus")->item(0))) {
goto YC;
}
$Gj = base64_decode($JN->nodeValue);
YC:
if (!($zp = $pK->getElementsByTagName("Exponent")->item(0))) {
goto D5;
}
$a1 = base64_decode($zp->nodeValue);
D5:
if (!(empty($Gj) || empty($a1))) {
goto HJ;
}
throw new Exception("Missing Modulus or Exponent");
HJ:
$UX = XMLSecurityKey::convertRSA($Gj, $a1);
$gY->loadKey($UX);
goto Xm;
}
wi:
Xm:
Ku:
}
dJ:
goto gL;
case "RetrievalMethod":
$f0 = $By->getAttribute("Type");
if (!($f0 !== "http://www.w3.org/2001/04/xmlenc#EncryptedKey")) {
goto nV;
}
goto gL;
nV:
$RL = $By->getAttribute("URI");
if (!($RL[0] !== "#")) {
goto uG;
}
goto gL;
uG:
$m9 = substr($RL, 1);
$oK = "//xmlsecenc:EncryptedKey[@Id="" . XPath::filterAttrValue($m9, XPath::DOUBLE_QUOTE) . ""]";
$tj = $J9->query($oK)->item(0);
if ($tj) {
goto k1;
}
throw new Exception("Unable to locate EncryptedKey with @Id='{$m9}'.");
k1:
return XMLSecurityKey::fromEncryptedKeyElement($tj);
case "EncryptedKey":
return XMLSecurityKey::fromEncryptedKeyElement($By);
case "X509Data":
if (!($RM = $By->getElementsByTagName("X509Certificate"))) {
goto VN;
}
if (!($RM->length > 0)) {
goto H2;
}
$js = $RM->item(0)->textContent;
$js = str_replace(array("\xd", "
", " "), '', $js);
$js = "-----BEGIN CERTIFICATE-----\xa" . chunk_split($js, 64, "\xa") . "-----END CERTIFICATE-----
";
$gY->loadKey($js, false, true);
H2:
VN:
goto gL;
}
wC:
gL:
er:
}
Mm:
return $gY;
}
public function locateKeyInfo($gY = null, $xV = null)
{
if (!empty($xV)) {
goto C4;
}
$xV = $this->rawNode;
C4:
return self::staticLocateKeyInfo($gY, $xV);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace RobRichards\XMLSecLibs;
use DOMDocument;
use DOMElement;
use DOMNode;
use DOMXPath;
use Exception;
use RobRichards\XMLSecLibs\Utils\XPath as XPath;
class XMLSecEnc
{
const template = "\74\x78\145\156\x63\72\x45\156\143\x72\171\x70\x74\x65\144\x44\141\164\x61\x20\x78\155\x6c\x6e\163\x3a\x78\x65\x6e\143\75\x27\x68\164\164\160\x3a\57\57\167\167\167\56\167\x33\x2e\157\x72\x67\57\62\60\x30\x31\57\60\x34\57\x78\x6d\154\145\x6e\x63\43\x27\76\15\12\40\x20\40\74\170\145\156\143\x3a\103\x69\160\x68\145\x72\x44\x61\x74\x61\x3e\xd\12\40\x20\x20\x20\x20\x20\x3c\170\x65\x6e\x63\72\x43\151\160\150\145\162\126\141\x6c\165\145\x3e\74\x2f\x78\x65\x6e\143\x3a\103\151\x70\x68\x65\162\126\x61\154\165\x65\76\15\xa\40\x20\x20\x3c\x2f\x78\x65\x6e\143\x3a\103\x69\160\150\x65\162\104\x61\x74\141\76\15\12\x3c\x2f\x78\145\156\143\x3a\105\156\143\x72\171\160\164\x65\144\104\141\x74\x61\76";
const Element = "\x68\x74\164\160\72\57\57\x77\167\x77\x2e\x77\x33\56\157\x72\x67\57\x32\60\60\x31\x2f\x30\64\x2f\x78\155\x6c\x65\x6e\143\43\x45\x6c\145\155\x65\156\164";
const Content = "\150\x74\164\x70\x3a\x2f\x2f\x77\167\167\x2e\167\x33\x2e\157\x72\147\57\x32\x30\x30\x31\x2f\60\x34\x2f\170\x6d\154\x65\156\143\x23\x43\x6f\156\164\x65\x6e\164";
const URI = 3;
const XMLENCNS = "\150\164\164\160\x3a\57\57\x77\x77\167\x2e\167\x33\x2e\x6f\x72\147\57\62\60\60\x31\57\60\x34\57\170\x6d\x6c\145\x6e\x63\43";
private $encdoc = null;
private $rawNode = null;
public $type = null;
public $encKey = null;
private $references = array();
public function __construct()
{
$this->_resetTemplate();
}
private function _resetTemplate()
{
$this->encdoc = new DOMDocument();
$this->encdoc->loadXML(self::template);
}
public function addReference($rU, $xV, $f0)
{
if ($xV instanceof DOMNode) {
goto gP;
}
throw new Exception("\x24\x6e\x6f\x64\x65\x20\151\x73\x20\156\157\x74\x20\157\x66\x20\x74\x79\x70\145\40\104\x4f\x4d\x4e\x6f\144\x65");
gP:
$uo = $this->encdoc;
$this->_resetTemplate();
$RF = $this->encdoc;
$this->encdoc = $uo;
$OF = XMLSecurityDSig::generateGUID();
$vM = $RF->documentElement;
$vM->setAttribute("\x49\x64", $OF);
$this->references[$rU] = array("\156\157\x64\x65" => $xV, "\164\x79\x70\x65" => $f0, "\145\156\x63\156\157\144\x65" => $RF, "\162\145\146\165\162\151" => $OF);
}
public function setNode($xV)
{
$this->rawNode = $xV;
}
public function encryptNode($ZA, $G0 = true)
{
$x4 = '';
if (!empty($this->rawNode)) {
goto tW;
}
throw new Exception("\x4e\x6f\144\x65\x20\x74\157\40\145\x6e\x63\x72\171\x70\164\40\150\141\x73\x20\x6e\157\x74\40\x62\x65\x65\x6e\40\x73\x65\x74");
tW:
if ($ZA instanceof XMLSecurityKey) {
goto Kx;
}
throw new Exception("\111\x6e\166\x61\154\151\x64\x20\x4b\x65\x79");
Kx:
$hU = $this->rawNode->ownerDocument;
$p2 = new DOMXPath($this->encdoc);
$Pr = $p2->query("\57\x78\145\x6e\x63\72\105\x6e\143\x72\x79\160\164\145\x64\x44\141\x74\141\57\170\145\156\143\72\x43\x69\160\x68\145\162\104\x61\164\x61\x2f\170\145\x6e\x63\72\103\151\160\x68\145\162\x56\141\x6c\x75\x65");
$ox = $Pr->item(0);
if (!($ox == null)) {
goto hb;
}
throw new Exception("\x45\162\x72\x6f\162\x20\154\x6f\x63\141\164\151\156\147\x20\103\151\160\150\145\x72\x56\141\154\x75\145\x20\145\154\145\155\x65\156\164\x20\167\x69\164\x68\151\156\40\x74\145\x6d\x70\154\141\164\145");
hb:
switch ($this->type) {
case self::Element:
$x4 = $hU->saveXML($this->rawNode);
$this->encdoc->documentElement->setAttribute("\x54\x79\160\x65", self::Element);
goto e8;
case self::Content:
$bB = $this->rawNode->childNodes;
foreach ($bB as $By) {
$x4 .= $hU->saveXML($By);
vW:
}
rg:
$this->encdoc->documentElement->setAttribute("\x54\171\160\x65", self::Content);
goto e8;
default:
throw new Exception("\124\x79\160\145\x20\x69\163\40\143\x75\162\x72\x65\156\164\154\171\x20\x6e\157\x74\40\163\x75\x70\x70\157\162\164\x65\144");
}
Bs:
e8:
$MS = $this->encdoc->documentElement->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\145\156\143\72\105\156\143\x72\171\x70\164\151\157\156\x4d\145\164\x68\157\144"));
$MS->setAttribute("\101\x6c\147\x6f\162\151\164\150\155", $ZA->getAlgorithm());
$ox->parentNode->parentNode->insertBefore($MS, $ox->parentNode->parentNode->firstChild);
$hL = base64_encode($ZA->encryptData($x4));
$tp = $this->encdoc->createTextNode($hL);
$ox->appendChild($tp);
if ($G0) {
goto TP;
}
return $this->encdoc->documentElement;
goto F8;
TP:
switch ($this->type) {
case self::Element:
if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
goto OE;
}
return $this->encdoc;
OE:
$b0 = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
$this->rawNode->parentNode->replaceChild($b0, $this->rawNode);
return $b0;
case self::Content:
$b0 = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
JL:
if (!$this->rawNode->firstChild) {
goto pp;
}
$this->rawNode->removeChild($this->rawNode->firstChild);
goto JL;
pp:
$this->rawNode->appendChild($b0);
return $b0;
}
i0:
RE:
F8:
}
public function encryptReferences($ZA)
{
$rz = $this->rawNode;
$zw = $this->type;
foreach ($this->references as $rU => $Yu) {
$this->encdoc = $Yu["\145\x6e\x63\x6e\x6f\144\x65"];
$this->rawNode = $Yu["\156\157\x64\145"];
$this->type = $Yu["\164\171\160\x65"];
try {
$DA = $this->encryptNode($ZA);
$this->references[$rU]["\145\156\143\156\x6f\x64\145"] = $DA;
} catch (Exception $u6) {
$this->rawNode = $rz;
$this->type = $zw;
throw $u6;
}
BM:
}
J3:
$this->rawNode = $rz;
$this->type = $zw;
}
public function getCipherValue()
{
if (!empty($this->rawNode)) {
goto gs;
}
throw new Exception("\116\157\x64\x65\x20\164\157\x20\144\x65\143\162\171\x70\x74\40\x68\x61\163\x20\156\x6f\164\40\x62\145\x65\156\40\163\145\164");
gs:
$hU = $this->rawNode->ownerDocument;
$p2 = new DOMXPath($hU);
$p2->registerNamespace("\x78\155\x6c\x65\156\x63\162", self::XMLENCNS);
$oK = "\x2e\x2f\170\155\154\x65\x6e\x63\162\72\103\x69\160\x68\x65\x72\104\141\164\x61\57\x78\x6d\154\x65\x6e\x63\x72\72\103\x69\x70\150\145\x72\126\x61\x6c\x75\x65";
$Nw = $p2->query($oK, $this->rawNode);
$xV = $Nw->item(0);
if ($xV) {
goto k7;
}
return null;
k7:
return base64_decode($xV->nodeValue);
}
public function decryptNode($ZA, $G0 = true)
{
if ($ZA instanceof XMLSecurityKey) {
goto ni;
}
throw new Exception("\x49\156\x76\141\154\x69\144\40\113\145\x79");
ni:
$F_ = $this->getCipherValue();
if ($F_) {
goto aJ;
}
throw new Exception("\x43\141\156\x6e\x6f\x74\40\x6c\x6f\143\141\x74\x65\x20\x65\x6e\x63\162\171\160\x74\145\144\40\144\x61\x74\x61");
goto FI;
aJ:
$Er = $ZA->decryptData($F_);
if ($G0) {
goto wL;
}
return $Er;
goto lM;
wL:
switch ($this->type) {
case self::Element:
$rK = new DOMDocument();
$rK->loadXML($Er);
if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
goto ej;
}
return $rK;
ej:
$b0 = $this->rawNode->ownerDocument->importNode($rK->documentElement, true);
$this->rawNode->parentNode->replaceChild($b0, $this->rawNode);
return $b0;
case self::Content:
if ($this->rawNode->nodeType == XML_DOCUMENT_NODE) {
goto jh;
}
$hU = $this->rawNode->ownerDocument;
goto yk;
jh:
$hU = $this->rawNode;
yk:
$Kn = $hU->createDocumentFragment();
$Kn->appendXML($Er);
$cr = $this->rawNode->parentNode;
$cr->replaceChild($Kn, $this->rawNode);
return $cr;
default:
return $Er;
}
nU:
H_:
lM:
FI:
}
public function encryptKey($je, $nj, $lY = true)
{
if (!(!$je instanceof XMLSecurityKey || !$nj instanceof XMLSecurityKey)) {
goto gS;
}
throw new Exception("\111\x6e\166\141\x6c\x69\x64\40\113\145\x79");
gS:
$BD = base64_encode($je->encryptData($nj->key));
$Z9 = $this->encdoc->documentElement;
$XD = $this->encdoc->createElementNS(self::XMLENCNS, "\x78\x65\x6e\x63\72\x45\156\143\162\x79\x70\x74\145\144\113\x65\x79");
if ($lY) {
goto Xk;
}
$this->encKey = $XD;
goto Th;
Xk:
$um = $Z9->insertBefore($this->encdoc->createElementNS("\150\x74\x74\160\72\57\x2f\x77\x77\167\x2e\x77\x33\x2e\157\162\x67\x2f\62\x30\60\60\57\60\71\57\x78\155\x6c\144\x73\x69\147\43", "\x64\x73\x69\147\x3a\x4b\x65\x79\111\156\146\157"), $Z9->firstChild);
$um->appendChild($XD);
Th:
$MS = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\x65\156\143\x3a\105\156\x63\162\171\x70\164\x69\157\156\x4d\145\x74\150\x6f\x64"));
$MS->setAttribute("\101\x6c\147\157\162\x69\x74\x68\x6d", $je->getAlgorith());
if (empty($je->name)) {
goto SD;
}
$um = $XD->appendChild($this->encdoc->createElementNS("\x68\x74\x74\160\x3a\57\x2f\167\x77\x77\x2e\x77\x33\56\157\162\x67\x2f\x32\60\60\60\x2f\60\71\x2f\170\155\x6c\x64\x73\151\147\x23", "\144\163\x69\147\72\113\145\171\x49\156\x66\x6f"));
$um->appendChild($this->encdoc->createElementNS("\150\164\x74\160\72\57\57\167\167\x77\56\167\x33\56\157\x72\147\x2f\x32\x30\60\x30\57\x30\x39\57\170\155\x6c\144\163\x69\147\43", "\x64\x73\x69\147\x3a\113\145\171\x4e\x61\155\145", $je->name));
SD:
$yV = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\x65\x6e\143\x3a\x43\151\x70\x68\145\162\104\141\x74\141"));
$yV->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\145\156\143\72\103\151\160\x68\x65\162\x56\x61\154\165\145", $BD));
if (!(is_array($this->references) && count($this->references) > 0)) {
goto Qa;
}
$v4 = $XD->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\145\x6e\143\x3a\x52\145\146\145\x72\x65\x6e\143\145\114\151\x73\x74"));
foreach ($this->references as $rU => $Yu) {
$OF = $Yu["\x72\x65\146\x75\x72\x69"];
$QT = $v4->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\170\145\156\143\72\x44\x61\x74\141\x52\145\x66\x65\x72\145\x6e\143\145"));
$QT->setAttribute("\x55\x52\x49", "\x23" . $OF);
gM:
}
l_:
Qa:
return;
}
public function decryptKey($XD)
{
if ($XD->isEncrypted) {
goto ZA;
}
throw new Exception("\113\145\x79\40\x69\x73\x20\x6e\157\x74\x20\x45\x6e\143\162\x79\160\x74\145\144");
ZA:
if (!empty($XD->key)) {
goto TF;
}
throw new Exception("\113\x65\x79\40\x69\163\x20\x6d\x69\163\163\151\156\x67\x20\144\x61\x74\x61\40\164\x6f\x20\160\x65\162\146\x6f\162\x6d\x20\164\150\145\x20\x64\145\x63\162\x79\160\164\151\157\x6e");
TF:
return $this->decryptNode($XD, false);
}
public function locateEncryptedData($vM)
{
if ($vM instanceof DOMDocument) {
goto Xd;
}
$hU = $vM->ownerDocument;
goto rF;
Xd:
$hU = $vM;
rF:
if (!$hU) {
goto FX;
}
$J9 = new DOMXPath($hU);
$oK = "\57\x2f\x2a\133\154\157\143\x61\154\x2d\x6e\141\155\x65\x28\x29\75\x27\x45\x6e\143\162\x79\x70\x74\145\x64\104\x61\164\141\x27\40\141\x6e\144\40\x6e\x61\155\x65\163\x70\141\143\145\x2d\x75\x72\151\50\x29\x3d\47" . self::XMLENCNS . "\47\135";
$Nw = $J9->query($oK);
return $Nw->item(0);
FX:
return null;
}
public function locateKey($xV = null)
{
if (!empty($xV)) {
goto MA;
}
$xV = $this->rawNode;
MA:
if ($xV instanceof DOMNode) {
goto j1;
}
return null;
j1:
if (!($hU = $xV->ownerDocument)) {
goto Li;
}
$J9 = new DOMXPath($hU);
$J9->registerNamespace("\170\155\154\163\145\143\145\156\x63", self::XMLENCNS);
$oK = "\x2e\57\57\x78\x6d\x6c\x73\x65\143\x65\156\x63\72\105\x6e\143\x72\171\x70\164\151\157\156\115\x65\x74\150\x6f\x64";
$Nw = $J9->query($oK, $xV);
if (!($XZ = $Nw->item(0))) {
goto nC;
}
$Bl = $XZ->getAttribute("\x41\154\147\157\x72\151\x74\150\155");
try {
$ZA = new XMLSecurityKey($Bl, array("\164\171\x70\145" => "\160\x72\x69\x76\x61\x74\145"));
} catch (Exception $u6) {
return null;
}
return $ZA;
nC:
Li:
return null;
}
public static function staticLocateKeyInfo($gY = null, $xV = null)
{
if (!(empty($xV) || !$xV instanceof DOMNode)) {
goto EF;
}
return null;
EF:
$hU = $xV->ownerDocument;
if ($hU) {
goto iZ;
}
return null;
iZ:
$J9 = new DOMXPath($hU);
$J9->registerNamespace("\170\x6d\154\163\145\x63\145\156\143", self::XMLENCNS);
$J9->registerNamespace("\170\x6d\154\x73\x65\x63\144\163\151\147", XMLSecurityDSig::XMLDSIGNS);
$oK = "\56\x2f\170\x6d\x6c\163\x65\143\144\163\x69\x67\x3a\x4b\x65\171\111\x6e\146\x6f";
$Nw = $J9->query($oK, $xV);
$XZ = $Nw->item(0);
if ($XZ) {
goto Cy;
}
return $gY;
Cy:
foreach ($XZ->childNodes as $By) {
switch ($By->localName) {
case "\x4b\x65\171\x4e\x61\x6d\145":
if (empty($gY)) {
goto KU;
}
$gY->name = $By->nodeValue;
KU:
goto gL;
case "\113\145\x79\126\x61\154\x75\x65":
foreach ($By->childNodes as $pK) {
switch ($pK->localName) {
case "\104\x53\x41\x4b\x65\x79\126\141\x6c\165\145":
throw new Exception("\x44\123\101\113\x65\x79\126\141\x6c\165\145\x20\143\165\x72\162\145\156\x74\x6c\x79\x20\x6e\157\x74\40\x73\165\160\160\157\162\164\x65\x64");
case "\122\x53\101\113\x65\171\126\x61\x6c\x75\145":
$Gj = null;
$a1 = null;
if (!($JN = $pK->getElementsByTagName("\x4d\x6f\144\x75\x6c\x75\163")->item(0))) {
goto YC;
}
$Gj = base64_decode($JN->nodeValue);
YC:
if (!($zp = $pK->getElementsByTagName("\105\x78\x70\157\x6e\x65\156\164")->item(0))) {
goto D5;
}
$a1 = base64_decode($zp->nodeValue);
D5:
if (!(empty($Gj) || empty($a1))) {
goto HJ;
}
throw new Exception("\x4d\151\163\163\151\156\x67\40\115\157\144\165\x6c\x75\x73\40\x6f\x72\x20\105\x78\x70\x6f\156\145\156\x74");
HJ:
$UX = XMLSecurityKey::convertRSA($Gj, $a1);
$gY->loadKey($UX);
goto Xm;
}
wi:
Xm:
Ku:
}
dJ:
goto gL;
case "\122\145\x74\162\x69\x65\x76\141\154\x4d\145\164\x68\x6f\144":
$f0 = $By->getAttribute("\124\171\160\145");
if (!($f0 !== "\150\x74\164\x70\72\x2f\x2f\167\x77\167\56\x77\63\56\x6f\x72\x67\57\62\x30\x30\61\57\x30\64\57\170\x6d\154\145\x6e\x63\43\x45\156\143\x72\x79\x70\x74\145\x64\x4b\145\171")) {
goto nV;
}
goto gL;
nV:
$RL = $By->getAttribute("\x55\x52\x49");
if (!($RL[0] !== "\x23")) {
goto uG;
}
goto gL;
uG:
$m9 = substr($RL, 1);
$oK = "\57\x2f\x78\155\154\x73\145\x63\145\156\143\72\105\156\x63\x72\171\160\164\145\144\x4b\145\171\x5b\100\111\x64\x3d\x22" . XPath::filterAttrValue($m9, XPath::DOUBLE_QUOTE) . "\x22\135";
$tj = $J9->query($oK)->item(0);
if ($tj) {
goto k1;
}
throw new Exception("\x55\156\141\x62\x6c\145\x20\164\157\40\x6c\157\x63\141\x74\x65\x20\x45\156\x63\162\x79\160\x74\x65\x64\x4b\145\x79\x20\167\151\164\x68\x20\x40\111\x64\x3d\47{$m9}\x27\x2e");
k1:
return XMLSecurityKey::fromEncryptedKeyElement($tj);
case "\x45\156\x63\162\x79\x70\164\145\144\113\x65\171":
return XMLSecurityKey::fromEncryptedKeyElement($By);
case "\130\x35\60\71\104\x61\164\x61":
if (!($RM = $By->getElementsByTagName("\130\x35\60\71\103\x65\x72\164\x69\x66\x69\x63\141\164\145"))) {
goto VN;
}
if (!($RM->length > 0)) {
goto H2;
}
$js = $RM->item(0)->textContent;
$js = str_replace(array("\xd", "\12", "\40"), '', $js);
$js = "\x2d\55\x2d\x2d\x2d\102\105\x47\x49\116\40\103\105\x52\124\111\x46\x49\x43\101\124\x45\55\x2d\x2d\55\55\xa" . chunk_split($js, 64, "\xa") . "\55\55\55\55\55\105\116\x44\40\103\x45\x52\x54\x49\x46\x49\103\101\124\105\55\x2d\55\x2d\x2d\12";
$gY->loadKey($js, false, true);
H2:
VN:
goto gL;
}
wC:
gL:
er:
}
Mm:
return $gY;
}
public function locateKeyInfo($gY = null, $xV = null)
{
if (!empty($xV)) {
goto C4;
}
$xV = $this->rawNode;
C4:
return self::staticLocateKeyInfo($gY, $xV);
}
}
Function Calls
None |
Stats
MD5 | 9cf18ee521dcf54c4fbd53e065a9ba4a |
Eval Count | 0 |
Decode Time | 47 ms |