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 /** * This file is a part of the miniorange-saml-20-single-sign-on plugin. * ..

Decoded Output download

<?php 
/** 
 * This file is a part of the miniorange-saml-20-single-sign-on plugin. 
 * 
 * @link https://plugins.miniorange.com/ 
 * @author miniOrange 
 * @package miniorange-saml-20-single-sign-on 
 */ 
 
 
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>
      <xenc:CipherValue></xenc:CipherValue>
   </xenc:CipherData>\xd\xa</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($TK, $c4, $CL) 
    { 
        if ($c4 instanceof DOMNode) { 
            goto mv; 
        } 
        throw new Exception("$node is not of type DOMNode"); 
        mv: 
        $RG = $this->encdoc; 
        $this->_resetTemplate(); 
        $HJ = $this->encdoc; 
        $this->encdoc = $RG; 
        $AW = XMLSecurityDSig::generateGUID(); 
        $Nd = $HJ->documentElement; 
        $Nd->setAttribute("Id", $AW); 
        $this->references[$TK] = array("node" => $c4, "type" => $CL, "encnode" => $HJ, "refuri" => $AW); 
    } 
    public function setNode($c4) 
    { 
        $this->rawNode = $c4; 
    } 
    public function encryptNode($px, $py = true) 
    { 
        $jQ = ''; 
        if (!empty($this->rawNode)) { 
            goto NS; 
        } 
        throw new Exception("Node to encrypt has not been set"); 
        NS: 
        if ($px instanceof XMLSecurityKey) { 
            goto Ml; 
        } 
        throw new Exception("Invalid Key"); 
        Ml: 
        $Hy = $this->rawNode->ownerDocument; 
        $am = new DOMXPath($this->encdoc); 
        $oY = $am->query("/xenc:EncryptedData/xenc:CipherData/xenc:CipherValue"); 
        $g2 = $oY->item(0); 
        if (!($g2 == null)) { 
            goto yw; 
        } 
        throw new Exception("Error locating CipherValue element within template"); 
        yw: 
        switch ($this->type) { 
            case self::Element: 
                $jQ = $Hy->saveXML($this->rawNode); 
                $this->encdoc->documentElement->setAttribute("Type", self::Element); 
                goto xn; 
            case self::Content: 
                $PB = $this->rawNode->childNodes; 
                foreach ($PB as $Ic) { 
                    $jQ .= $Hy->saveXML($Ic); 
                    lg: 
                } 
                o3: 
                $this->encdoc->documentElement->setAttribute("Type", self::Content); 
                goto xn; 
            default: 
                throw new Exception("Type is currently not supported"); 
        } 
        TB: 
        xn: 
        $jv = $this->encdoc->documentElement->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptionMethod")); 
        $jv->setAttribute("Algorithm", $px->getAlgorithm()); 
        $g2->parentNode->parentNode->insertBefore($jv, $g2->parentNode->parentNode->firstChild); 
        $Wd = base64_encode($px->encryptData($jQ)); 
        $Hr = $this->encdoc->createTextNode($Wd); 
        $g2->appendChild($Hr); 
        if ($py) { 
            goto Nd; 
        } 
        return $this->encdoc->documentElement; 
        goto yF; 
        Nd: 
        switch ($this->type) { 
            case self::Element: 
                if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) { 
                    goto zA; 
                } 
                return $this->encdoc; 
                zA: 
                $Ay = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true); 
                $this->rawNode->parentNode->replaceChild($Ay, $this->rawNode); 
                return $Ay; 
            case self::Content: 
                $Ay = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true); 
                ri: 
                if (!$this->rawNode->firstChild) { 
                    goto Ld; 
                } 
                $this->rawNode->removeChild($this->rawNode->firstChild); 
                goto ri; 
                Ld: 
                $this->rawNode->appendChild($Ay); 
                return $Ay; 
        } 
        GB: 
        qR: 
        yF: 
    } 
    public function encryptReferences($px) 
    { 
        $yZ = $this->rawNode; 
        $WQ = $this->type; 
        foreach ($this->references as $TK => $ub) { 
            $this->encdoc = $ub["encnode"]; 
            $this->rawNode = $ub["node"]; 
            $this->type = $ub["type"]; 
            try { 
                $bj = $this->encryptNode($px); 
                $this->references[$TK]["encnode"] = $bj; 
            } catch (Exception $XJ) { 
                $this->rawNode = $yZ; 
                $this->type = $WQ; 
                throw $XJ; 
            } 
            h4: 
        } 
        nJ: 
        $this->rawNode = $yZ; 
        $this->type = $WQ; 
    } 
    public function getCipherValue() 
    { 
        if (!empty($this->rawNode)) { 
            goto dg; 
        } 
        throw new Exception("Node to decrypt has not been set"); 
        dg: 
        $Hy = $this->rawNode->ownerDocument; 
        $am = new DOMXPath($Hy); 
        $am->registerNamespace("xmlencr", self::XMLENCNS); 
        $oi = "./xmlencr:CipherData/xmlencr:CipherValue"; 
        $kB = $am->query($oi, $this->rawNode); 
        $c4 = $kB->item(0); 
        if ($c4) { 
            goto u6; 
        } 
        return null; 
        u6: 
        return base64_decode($c4->nodeValue); 
    } 
    public function decryptNode($px, $py = true) 
    { 
        if ($px instanceof XMLSecurityKey) { 
            goto GN; 
        } 
        throw new Exception("Invalid Key"); 
        GN: 
        $cR = $this->getCipherValue(); 
        if ($cR) { 
            goto eR; 
        } 
        throw new Exception("Cannot locate encrypted data"); 
        goto YM; 
        eR: 
        $tN = $px->decryptData($cR); 
        if ($py) { 
            goto PQ; 
        } 
        return $tN; 
        goto zX; 
        PQ: 
        switch ($this->type) { 
            case self::Element: 
                $rd = new DOMDocument(); 
                $rd->loadXML($tN); 
                if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) { 
                    goto J4; 
                } 
                return $rd; 
                J4: 
                $Ay = $this->rawNode->ownerDocument->importNode($rd->documentElement, true); 
                $this->rawNode->parentNode->replaceChild($Ay, $this->rawNode); 
                return $Ay; 
            case self::Content: 
                if ($this->rawNode->nodeType == XML_DOCUMENT_NODE) { 
                    goto qS; 
                } 
                $Hy = $this->rawNode->ownerDocument; 
                goto Bh; 
                qS: 
                $Hy = $this->rawNode; 
                Bh: 
                $qq = $Hy->createDocumentFragment(); 
                $qq->appendXML($tN); 
                $dV = $this->rawNode->parentNode; 
                $dV->replaceChild($qq, $this->rawNode); 
                return $dV; 
            default: 
                return $tN; 
        } 
        vD: 
        Sp: 
        zX: 
        YM: 
    } 
    public function encryptKey($E4, $Ex, $Oe = true) 
    { 
        if (!(!$E4 instanceof XMLSecurityKey || !$Ex instanceof XMLSecurityKey)) { 
            goto XP; 
        } 
        throw new Exception("Invalid Key"); 
        XP: 
        $gA = base64_encode($E4->encryptData($Ex->key)); 
        $Bs = $this->encdoc->documentElement; 
        $hA = $this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptedKey"); 
        if ($Oe) { 
            goto f7; 
        } 
        $this->encKey = $hA; 
        goto uk; 
        f7: 
        $e6 = $Bs->insertBefore($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyInfo"), $Bs->firstChild); 
        $e6->appendChild($hA); 
        uk: 
        $jv = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:EncryptionMethod")); 
        $jv->setAttribute("Algorithm", $E4->getAlgorith()); 
        if (empty($E4->name)) { 
            goto Uw; 
        } 
        $e6 = $hA->appendChild($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyInfo")); 
        $e6->appendChild($this->encdoc->createElementNS("http://www.w3.org/2000/09/xmldsig#", "dsig:KeyName", $E4->name)); 
        Uw: 
        $O3 = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:CipherData")); 
        $O3->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:CipherValue", $gA)); 
        if (!(is_array($this->references) && count($this->references) > 0)) { 
            goto kM; 
        } 
        $EN = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:ReferenceList")); 
        foreach ($this->references as $TK => $ub) { 
            $AW = $ub["refuri"]; 
            $Yd = $EN->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "xenc:DataReference")); 
            $Yd->setAttribute("URI", "#" . $AW); 
            yC: 
        } 
        XO: 
        kM: 
        return; 
    } 
    public function decryptKey($hA) 
    { 
        if ($hA->isEncrypted) { 
            goto qO; 
        } 
        throw new Exception("Key is not Encrypted"); 
        qO: 
        if (!empty($hA->key)) { 
            goto gC; 
        } 
        throw new Exception("Key is missing data to perform the decryption"); 
        gC: 
        return $this->decryptNode($hA, false); 
    } 
    public function locateEncryptedData($Nd) 
    { 
        if ($Nd instanceof DOMDocument) { 
            goto II; 
        } 
        $Hy = $Nd->ownerDocument; 
        goto yi; 
        II: 
        $Hy = $Nd; 
        yi: 
        if (!$Hy) { 
            goto W2; 
        } 
        $Iw = new DOMXPath($Hy); 
        $oi = "//*[local-name()='EncryptedData' and namespace-uri()='" . self::XMLENCNS . "']"; 
        $kB = $Iw->query($oi); 
        return $kB->item(0); 
        W2: 
        return null; 
    } 
    public function locateKey($c4 = null) 
    { 
        if (!empty($c4)) { 
            goto lc; 
        } 
        $c4 = $this->rawNode; 
        lc: 
        if ($c4 instanceof DOMNode) { 
            goto tT; 
        } 
        return null; 
        tT: 
        if (!($Hy = $c4->ownerDocument)) { 
            goto nB; 
        } 
        $Iw = new DOMXPath($Hy); 
        $Iw->registerNamespace("xmlsecenc", self::XMLENCNS); 
        $oi = ".//xmlsecenc:EncryptionMethod"; 
        $kB = $Iw->query($oi, $c4); 
        if (!($T6 = $kB->item(0))) { 
            goto r8; 
        } 
        $zM = $T6->getAttribute("Algorithm"); 
        try { 
            $px = new XMLSecurityKey($zM, array("type" => "private")); 
        } catch (Exception $XJ) { 
            return null; 
        } 
        return $px; 
        r8: 
        nB: 
        return null; 
    } 
    public static function staticLocateKeyInfo($RB = null, $c4 = null) 
    { 
        if (!(empty($c4) || !$c4 instanceof DOMNode)) { 
            goto X7; 
        } 
        return null; 
        X7: 
        $Hy = $c4->ownerDocument; 
        if ($Hy) { 
            goto Jt; 
        } 
        return null; 
        Jt: 
        $Iw = new DOMXPath($Hy); 
        $Iw->registerNamespace("xmlsecenc", self::XMLENCNS); 
        $Iw->registerNamespace("xmlsecdsig", XMLSecurityDSig::XMLDSIGNS); 
        $oi = "./xmlsecdsig:KeyInfo"; 
        $kB = $Iw->query($oi, $c4); 
        $T6 = $kB->item(0); 
        if ($T6) { 
            goto Ao; 
        } 
        return $RB; 
        Ao: 
        foreach ($T6->childNodes as $Ic) { 
            switch ($Ic->localName) { 
                case "KeyName": 
                    if (empty($RB)) { 
                        goto A2; 
                    } 
                    $RB->name = $Ic->nodeValue; 
                    A2: 
                    goto ez; 
                case "KeyValue": 
                    foreach ($Ic->childNodes as $Yv) { 
                        switch ($Yv->localName) { 
                            case "DSAKeyValue": 
                                throw new Exception("DSAKeyValue currently not supported"); 
                            case "RSAKeyValue": 
                                $HR = null; 
                                $qN = null; 
                                if (!($tb = $Yv->getElementsByTagName("Modulus")->item(0))) { 
                                    goto Kd; 
                                } 
                                $HR = base64_decode($tb->nodeValue); 
                                Kd: 
                                if (!($m2 = $Yv->getElementsByTagName("Exponent")->item(0))) { 
                                    goto Ui; 
                                } 
                                $qN = base64_decode($m2->nodeValue); 
                                Ui: 
                                if (!(empty($HR) || empty($qN))) { 
                                    goto Km; 
                                } 
                                throw new Exception("Missing Modulus or Exponent"); 
                                Km: 
                                $sQ = XMLSecurityKey::convertRSA($HR, $qN); 
                                $RB->loadKey($sQ); 
                                goto SG; 
                        } 
                        ig: 
                        SG: 
                        Kq: 
                    } 
                    kD: 
                    goto ez; 
                case "RetrievalMethod": 
                    $CL = $Ic->getAttribute("Type"); 
                    if (!($CL !== "http://www.w3.org/2001/04/xmlenc#EncryptedKey")) { 
                        goto u9; 
                    } 
                    goto ez; 
                    u9: 
                    $pF = $Ic->getAttribute("URI"); 
                    if (!($pF[0] !== "#")) { 
                        goto b2; 
                    } 
                    goto ez; 
                    b2: 
                    $Cv = substr($pF, 1); 
                    $oi = "//xmlsecenc:EncryptedKey[@Id="" . XPath::filterAttrValue($Cv, XPath::DOUBLE_QUOTE) . ""]"; 
                    $Id = $Iw->query($oi)->item(0); 
                    if ($Id) { 
                        goto Dz; 
                    } 
                    throw new Exception("Unable to locate EncryptedKey with @Id='{$Cv}'."); 
                    Dz: 
                    return XMLSecurityKey::fromEncryptedKeyElement($Id); 
                case "EncryptedKey": 
                    return XMLSecurityKey::fromEncryptedKeyElement($Ic); 
                case "X509Data": 
                    if (!($Ej = $Ic->getElementsByTagName("X509Certificate"))) { 
                        goto Lq; 
                    } 
                    if (!($Ej->length > 0)) { 
                        goto yt; 
                    } 
                    $WE = $Ej->item(0)->textContent; 
                    $WE = str_replace(array("\xd", "
", " "), '', $WE); 
                    $WE = "-----BEGIN CERTIFICATE-----
" . chunk_split($WE, 64, "\xa") . "-----END CERTIFICATE-----
"; 
                    $RB->loadKey($WE, false, true); 
                    yt: 
                    Lq: 
                    goto ez; 
            } 
            w8: 
            ez: 
            xM: 
        } 
        XG: 
        return $RB; 
    } 
    public function locateKeyInfo($RB = null, $c4 = null) 
    { 
        if (!empty($c4)) { 
            goto Pt; 
        } 
        $c4 = $this->rawNode; 
        Pt: 
        return self::staticLocateKeyInfo($RB, $c4); 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * This file is a part of the miniorange-saml-20-single-sign-on plugin.
 *
 * @link https://plugins.miniorange.com/
 * @author miniOrange
 * @package miniorange-saml-20-single-sign-on
 */


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\170\x65\x6e\143\x3a\105\156\x63\x72\x79\160\x74\145\144\x44\x61\164\x61\x20\170\155\x6c\156\x73\x3a\x78\x65\156\143\75\47\150\164\164\x70\x3a\57\x2f\167\167\167\56\x77\x33\x2e\157\162\x67\57\x32\60\60\x31\x2f\60\64\x2f\170\155\154\x65\x6e\x63\43\47\x3e\15\12\40\x20\x20\x3c\170\x65\x6e\x63\x3a\103\151\160\150\145\x72\104\x61\164\141\76\15\12\40\40\40\x20\40\x20\x3c\x78\145\x6e\143\x3a\x43\x69\160\x68\145\162\x56\141\x6c\x75\145\x3e\74\57\170\x65\x6e\143\x3a\103\151\x70\150\145\162\x56\x61\x6c\x75\145\76\15\12\x20\x20\40\x3c\57\x78\x65\x6e\143\72\103\151\x70\x68\145\x72\104\141\x74\141\x3e\xd\xa\x3c\x2f\x78\145\156\143\72\105\x6e\143\x72\171\x70\x74\x65\144\104\141\164\x61\x3e";
    const Element = "\150\164\x74\160\72\57\x2f\x77\x77\167\x2e\x77\x33\56\157\162\x67\57\62\x30\60\61\57\x30\64\57\x78\x6d\154\145\156\x63\x23\x45\154\145\x6d\145\x6e\164";
    const Content = "\150\164\x74\160\72\57\x2f\167\167\x77\x2e\167\x33\56\157\162\x67\x2f\x32\60\60\x31\57\x30\64\x2f\x78\155\154\x65\156\x63\x23\103\157\x6e\x74\x65\156\x74";
    const URI = 3;
    const XMLENCNS = "\150\x74\164\160\x3a\57\x2f\x77\x77\x77\56\167\63\x2e\x6f\x72\x67\57\62\x30\x30\x31\57\60\64\57\x78\x6d\x6c\145\x6e\143\x23";
    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($TK, $c4, $CL)
    {
        if ($c4 instanceof DOMNode) {
            goto mv;
        }
        throw new Exception("\x24\x6e\157\144\145\40\151\x73\40\156\x6f\x74\x20\x6f\x66\40\x74\171\160\x65\x20\104\x4f\115\x4e\x6f\x64\145");
        mv:
        $RG = $this->encdoc;
        $this->_resetTemplate();
        $HJ = $this->encdoc;
        $this->encdoc = $RG;
        $AW = XMLSecurityDSig::generateGUID();
        $Nd = $HJ->documentElement;
        $Nd->setAttribute("\x49\x64", $AW);
        $this->references[$TK] = array("\156\157\x64\x65" => $c4, "\x74\x79\x70\145" => $CL, "\x65\x6e\143\156\x6f\144\x65" => $HJ, "\x72\x65\x66\x75\x72\151" => $AW);
    }
    public function setNode($c4)
    {
        $this->rawNode = $c4;
    }
    public function encryptNode($px, $py = true)
    {
        $jQ = '';
        if (!empty($this->rawNode)) {
            goto NS;
        }
        throw new Exception("\x4e\x6f\x64\145\x20\x74\x6f\x20\145\x6e\x63\162\x79\160\x74\x20\150\141\x73\x20\156\157\x74\x20\x62\145\145\x6e\x20\163\x65\x74");
        NS:
        if ($px instanceof XMLSecurityKey) {
            goto Ml;
        }
        throw new Exception("\111\x6e\166\x61\154\x69\144\x20\x4b\x65\x79");
        Ml:
        $Hy = $this->rawNode->ownerDocument;
        $am = new DOMXPath($this->encdoc);
        $oY = $am->query("\x2f\170\145\x6e\x63\x3a\x45\156\143\x72\171\x70\x74\x65\144\104\141\x74\141\x2f\x78\x65\156\143\72\x43\151\160\150\145\x72\x44\141\164\x61\57\170\145\156\143\x3a\x43\151\x70\150\x65\x72\126\x61\154\165\x65");
        $g2 = $oY->item(0);
        if (!($g2 == null)) {
            goto yw;
        }
        throw new Exception("\x45\x72\162\157\162\40\154\x6f\143\x61\164\151\156\x67\x20\x43\151\x70\150\x65\162\x56\x61\x6c\x75\145\x20\145\x6c\145\x6d\145\x6e\x74\40\167\x69\x74\150\x69\x6e\x20\x74\145\155\x70\154\141\x74\145");
        yw:
        switch ($this->type) {
            case self::Element:
                $jQ = $Hy->saveXML($this->rawNode);
                $this->encdoc->documentElement->setAttribute("\x54\x79\x70\145", self::Element);
                goto xn;
            case self::Content:
                $PB = $this->rawNode->childNodes;
                foreach ($PB as $Ic) {
                    $jQ .= $Hy->saveXML($Ic);
                    lg:
                }
                o3:
                $this->encdoc->documentElement->setAttribute("\124\171\x70\x65", self::Content);
                goto xn;
            default:
                throw new Exception("\x54\171\x70\x65\40\151\163\40\x63\165\x72\x72\145\x6e\164\x6c\171\40\156\157\x74\x20\163\x75\x70\160\x6f\162\x74\145\144");
        }
        TB:
        xn:
        $jv = $this->encdoc->documentElement->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\145\156\143\x3a\105\x6e\x63\162\171\x70\164\151\157\156\x4d\145\164\150\157\144"));
        $jv->setAttribute("\x41\x6c\x67\157\x72\x69\164\x68\155", $px->getAlgorithm());
        $g2->parentNode->parentNode->insertBefore($jv, $g2->parentNode->parentNode->firstChild);
        $Wd = base64_encode($px->encryptData($jQ));
        $Hr = $this->encdoc->createTextNode($Wd);
        $g2->appendChild($Hr);
        if ($py) {
            goto Nd;
        }
        return $this->encdoc->documentElement;
        goto yF;
        Nd:
        switch ($this->type) {
            case self::Element:
                if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
                    goto zA;
                }
                return $this->encdoc;
                zA:
                $Ay = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
                $this->rawNode->parentNode->replaceChild($Ay, $this->rawNode);
                return $Ay;
            case self::Content:
                $Ay = $this->rawNode->ownerDocument->importNode($this->encdoc->documentElement, true);
                ri:
                if (!$this->rawNode->firstChild) {
                    goto Ld;
                }
                $this->rawNode->removeChild($this->rawNode->firstChild);
                goto ri;
                Ld:
                $this->rawNode->appendChild($Ay);
                return $Ay;
        }
        GB:
        qR:
        yF:
    }
    public function encryptReferences($px)
    {
        $yZ = $this->rawNode;
        $WQ = $this->type;
        foreach ($this->references as $TK => $ub) {
            $this->encdoc = $ub["\145\x6e\143\x6e\x6f\144\x65"];
            $this->rawNode = $ub["\x6e\x6f\144\x65"];
            $this->type = $ub["\164\171\160\x65"];
            try {
                $bj = $this->encryptNode($px);
                $this->references[$TK]["\x65\x6e\x63\x6e\x6f\x64\x65"] = $bj;
            } catch (Exception $XJ) {
                $this->rawNode = $yZ;
                $this->type = $WQ;
                throw $XJ;
            }
            h4:
        }
        nJ:
        $this->rawNode = $yZ;
        $this->type = $WQ;
    }
    public function getCipherValue()
    {
        if (!empty($this->rawNode)) {
            goto dg;
        }
        throw new Exception("\x4e\x6f\x64\145\x20\164\x6f\40\x64\x65\x63\x72\171\160\164\40\x68\x61\163\x20\156\x6f\164\40\142\145\145\156\x20\163\145\164");
        dg:
        $Hy = $this->rawNode->ownerDocument;
        $am = new DOMXPath($Hy);
        $am->registerNamespace("\170\x6d\x6c\145\156\x63\162", self::XMLENCNS);
        $oi = "\56\x2f\x78\x6d\154\x65\156\x63\x72\72\x43\151\160\150\145\162\104\x61\164\141\x2f\x78\x6d\154\145\156\x63\x72\x3a\103\x69\160\150\x65\162\126\141\154\165\145";
        $kB = $am->query($oi, $this->rawNode);
        $c4 = $kB->item(0);
        if ($c4) {
            goto u6;
        }
        return null;
        u6:
        return base64_decode($c4->nodeValue);
    }
    public function decryptNode($px, $py = true)
    {
        if ($px instanceof XMLSecurityKey) {
            goto GN;
        }
        throw new Exception("\111\x6e\166\x61\x6c\x69\144\x20\x4b\x65\171");
        GN:
        $cR = $this->getCipherValue();
        if ($cR) {
            goto eR;
        }
        throw new Exception("\103\x61\x6e\156\x6f\164\x20\154\157\x63\141\x74\x65\x20\145\x6e\x63\162\x79\160\x74\x65\144\40\x64\x61\164\x61");
        goto YM;
        eR:
        $tN = $px->decryptData($cR);
        if ($py) {
            goto PQ;
        }
        return $tN;
        goto zX;
        PQ:
        switch ($this->type) {
            case self::Element:
                $rd = new DOMDocument();
                $rd->loadXML($tN);
                if (!($this->rawNode->nodeType == XML_DOCUMENT_NODE)) {
                    goto J4;
                }
                return $rd;
                J4:
                $Ay = $this->rawNode->ownerDocument->importNode($rd->documentElement, true);
                $this->rawNode->parentNode->replaceChild($Ay, $this->rawNode);
                return $Ay;
            case self::Content:
                if ($this->rawNode->nodeType == XML_DOCUMENT_NODE) {
                    goto qS;
                }
                $Hy = $this->rawNode->ownerDocument;
                goto Bh;
                qS:
                $Hy = $this->rawNode;
                Bh:
                $qq = $Hy->createDocumentFragment();
                $qq->appendXML($tN);
                $dV = $this->rawNode->parentNode;
                $dV->replaceChild($qq, $this->rawNode);
                return $dV;
            default:
                return $tN;
        }
        vD:
        Sp:
        zX:
        YM:
    }
    public function encryptKey($E4, $Ex, $Oe = true)
    {
        if (!(!$E4 instanceof XMLSecurityKey || !$Ex instanceof XMLSecurityKey)) {
            goto XP;
        }
        throw new Exception("\111\x6e\x76\x61\154\151\x64\40\x4b\x65\171");
        XP:
        $gA = base64_encode($E4->encryptData($Ex->key));
        $Bs = $this->encdoc->documentElement;
        $hA = $this->encdoc->createElementNS(self::XMLENCNS, "\170\x65\156\143\x3a\105\x6e\143\x72\171\160\x74\145\x64\113\145\x79");
        if ($Oe) {
            goto f7;
        }
        $this->encKey = $hA;
        goto uk;
        f7:
        $e6 = $Bs->insertBefore($this->encdoc->createElementNS("\150\x74\x74\160\x3a\57\57\x77\x77\x77\x2e\x77\63\56\157\162\x67\57\x32\x30\60\x30\x2f\x30\71\x2f\x78\x6d\154\144\x73\x69\147\43", "\144\163\x69\x67\72\x4b\x65\171\x49\x6e\x66\x6f"), $Bs->firstChild);
        $e6->appendChild($hA);
        uk:
        $jv = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\170\145\156\143\72\105\156\x63\x72\171\x70\164\x69\x6f\x6e\x4d\145\164\x68\x6f\x64"));
        $jv->setAttribute("\x41\154\x67\x6f\x72\151\164\x68\x6d", $E4->getAlgorith());
        if (empty($E4->name)) {
            goto Uw;
        }
        $e6 = $hA->appendChild($this->encdoc->createElementNS("\x68\x74\164\x70\x3a\57\57\x77\167\167\56\x77\63\x2e\157\x72\x67\57\x32\x30\60\x30\57\x30\x39\57\170\155\x6c\144\x73\151\147\43", "\144\163\x69\147\x3a\113\x65\x79\111\156\x66\x6f"));
        $e6->appendChild($this->encdoc->createElementNS("\x68\x74\164\160\72\x2f\x2f\x77\x77\167\x2e\167\x33\x2e\x6f\x72\x67\x2f\62\x30\x30\x30\57\60\x39\57\x78\155\154\144\163\x69\147\43", "\x64\x73\x69\147\72\x4b\x65\x79\116\x61\155\145", $E4->name));
        Uw:
        $O3 = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\170\x65\156\143\72\x43\x69\x70\x68\145\162\104\141\164\x61"));
        $O3->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\170\x65\x6e\x63\72\x43\151\x70\x68\x65\162\126\141\154\165\x65", $gA));
        if (!(is_array($this->references) && count($this->references) > 0)) {
            goto kM;
        }
        $EN = $hA->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\x65\156\x63\72\122\145\146\145\x72\x65\x6e\143\145\x4c\151\163\x74"));
        foreach ($this->references as $TK => $ub) {
            $AW = $ub["\x72\145\x66\165\x72\151"];
            $Yd = $EN->appendChild($this->encdoc->createElementNS(self::XMLENCNS, "\x78\x65\156\143\x3a\104\141\164\x61\x52\x65\x66\145\162\145\x6e\143\145"));
            $Yd->setAttribute("\125\x52\x49", "\43" . $AW);
            yC:
        }
        XO:
        kM:
        return;
    }
    public function decryptKey($hA)
    {
        if ($hA->isEncrypted) {
            goto qO;
        }
        throw new Exception("\113\145\x79\40\x69\x73\x20\x6e\x6f\x74\40\x45\156\x63\162\x79\x70\x74\x65\x64");
        qO:
        if (!empty($hA->key)) {
            goto gC;
        }
        throw new Exception("\x4b\x65\171\40\x69\163\x20\x6d\x69\x73\163\151\156\x67\x20\x64\x61\164\141\x20\164\157\x20\160\145\162\x66\157\162\155\40\x74\x68\x65\x20\144\145\143\162\171\160\x74\151\157\156");
        gC:
        return $this->decryptNode($hA, false);
    }
    public function locateEncryptedData($Nd)
    {
        if ($Nd instanceof DOMDocument) {
            goto II;
        }
        $Hy = $Nd->ownerDocument;
        goto yi;
        II:
        $Hy = $Nd;
        yi:
        if (!$Hy) {
            goto W2;
        }
        $Iw = new DOMXPath($Hy);
        $oi = "\57\57\52\133\x6c\157\x63\141\154\x2d\156\141\155\145\x28\51\x3d\47\105\x6e\143\x72\x79\x70\x74\x65\144\104\141\164\141\47\40\141\156\144\x20\156\141\x6d\x65\163\160\x61\x63\x65\55\165\x72\151\50\x29\x3d\47" . self::XMLENCNS . "\x27\135";
        $kB = $Iw->query($oi);
        return $kB->item(0);
        W2:
        return null;
    }
    public function locateKey($c4 = null)
    {
        if (!empty($c4)) {
            goto lc;
        }
        $c4 = $this->rawNode;
        lc:
        if ($c4 instanceof DOMNode) {
            goto tT;
        }
        return null;
        tT:
        if (!($Hy = $c4->ownerDocument)) {
            goto nB;
        }
        $Iw = new DOMXPath($Hy);
        $Iw->registerNamespace("\x78\155\154\x73\145\143\x65\156\143", self::XMLENCNS);
        $oi = "\x2e\x2f\x2f\170\155\154\x73\x65\143\145\156\143\x3a\105\x6e\x63\x72\x79\x70\164\x69\x6f\156\115\x65\164\150\x6f\144";
        $kB = $Iw->query($oi, $c4);
        if (!($T6 = $kB->item(0))) {
            goto r8;
        }
        $zM = $T6->getAttribute("\101\x6c\147\157\162\151\164\150\155");
        try {
            $px = new XMLSecurityKey($zM, array("\164\x79\x70\145" => "\x70\x72\151\166\x61\x74\145"));
        } catch (Exception $XJ) {
            return null;
        }
        return $px;
        r8:
        nB:
        return null;
    }
    public static function staticLocateKeyInfo($RB = null, $c4 = null)
    {
        if (!(empty($c4) || !$c4 instanceof DOMNode)) {
            goto X7;
        }
        return null;
        X7:
        $Hy = $c4->ownerDocument;
        if ($Hy) {
            goto Jt;
        }
        return null;
        Jt:
        $Iw = new DOMXPath($Hy);
        $Iw->registerNamespace("\x78\x6d\154\x73\x65\143\x65\x6e\x63", self::XMLENCNS);
        $Iw->registerNamespace("\x78\155\x6c\x73\145\143\144\163\151\x67", XMLSecurityDSig::XMLDSIGNS);
        $oi = "\x2e\x2f\170\155\x6c\x73\x65\143\144\163\x69\147\72\x4b\145\171\x49\156\146\157";
        $kB = $Iw->query($oi, $c4);
        $T6 = $kB->item(0);
        if ($T6) {
            goto Ao;
        }
        return $RB;
        Ao:
        foreach ($T6->childNodes as $Ic) {
            switch ($Ic->localName) {
                case "\113\145\x79\116\x61\x6d\145":
                    if (empty($RB)) {
                        goto A2;
                    }
                    $RB->name = $Ic->nodeValue;
                    A2:
                    goto ez;
                case "\113\x65\x79\x56\x61\x6c\x75\145":
                    foreach ($Ic->childNodes as $Yv) {
                        switch ($Yv->localName) {
                            case "\104\x53\x41\113\145\x79\x56\x61\x6c\165\x65":
                                throw new Exception("\x44\123\101\x4b\x65\x79\126\x61\154\165\145\40\x63\x75\162\162\x65\156\164\154\171\x20\156\x6f\x74\40\x73\x75\x70\160\157\x72\164\145\x64");
                            case "\x52\123\101\x4b\145\171\126\141\x6c\165\145":
                                $HR = null;
                                $qN = null;
                                if (!($tb = $Yv->getElementsByTagName("\115\157\144\x75\154\165\163")->item(0))) {
                                    goto Kd;
                                }
                                $HR = base64_decode($tb->nodeValue);
                                Kd:
                                if (!($m2 = $Yv->getElementsByTagName("\105\170\160\157\x6e\145\x6e\164")->item(0))) {
                                    goto Ui;
                                }
                                $qN = base64_decode($m2->nodeValue);
                                Ui:
                                if (!(empty($HR) || empty($qN))) {
                                    goto Km;
                                }
                                throw new Exception("\x4d\x69\x73\x73\x69\x6e\x67\40\x4d\x6f\x64\x75\154\165\x73\x20\x6f\162\40\105\x78\x70\x6f\x6e\x65\x6e\164");
                                Km:
                                $sQ = XMLSecurityKey::convertRSA($HR, $qN);
                                $RB->loadKey($sQ);
                                goto SG;
                        }
                        ig:
                        SG:
                        Kq:
                    }
                    kD:
                    goto ez;
                case "\x52\x65\x74\162\x69\x65\x76\x61\x6c\115\145\x74\x68\157\144":
                    $CL = $Ic->getAttribute("\x54\171\160\x65");
                    if (!($CL !== "\x68\164\x74\160\x3a\x2f\x2f\x77\167\167\56\x77\63\56\x6f\x72\x67\57\x32\x30\x30\x31\x2f\60\64\x2f\170\155\x6c\145\x6e\143\x23\105\x6e\143\162\x79\x70\x74\x65\x64\x4b\x65\171")) {
                        goto u9;
                    }
                    goto ez;
                    u9:
                    $pF = $Ic->getAttribute("\x55\x52\x49");
                    if (!($pF[0] !== "\x23")) {
                        goto b2;
                    }
                    goto ez;
                    b2:
                    $Cv = substr($pF, 1);
                    $oi = "\x2f\57\170\155\154\163\x65\143\x65\x6e\x63\x3a\105\156\x63\162\171\x70\164\145\x64\113\145\x79\x5b\100\111\144\x3d\42" . XPath::filterAttrValue($Cv, XPath::DOUBLE_QUOTE) . "\x22\x5d";
                    $Id = $Iw->query($oi)->item(0);
                    if ($Id) {
                        goto Dz;
                    }
                    throw new Exception("\125\x6e\141\142\154\145\40\164\157\40\154\x6f\x63\141\164\145\40\105\156\143\x72\x79\x70\x74\145\x64\x4b\x65\171\40\167\151\164\150\40\100\111\144\x3d\x27{$Cv}\x27\x2e");
                    Dz:
                    return XMLSecurityKey::fromEncryptedKeyElement($Id);
                case "\105\x6e\x63\x72\x79\x70\x74\x65\144\113\x65\171":
                    return XMLSecurityKey::fromEncryptedKeyElement($Ic);
                case "\x58\x35\60\x39\104\x61\x74\141":
                    if (!($Ej = $Ic->getElementsByTagName("\x58\65\x30\x39\x43\145\x72\164\x69\146\151\x63\141\x74\x65"))) {
                        goto Lq;
                    }
                    if (!($Ej->length > 0)) {
                        goto yt;
                    }
                    $WE = $Ej->item(0)->textContent;
                    $WE = str_replace(array("\xd", "\12", "\x20"), '', $WE);
                    $WE = "\x2d\55\55\55\x2d\102\105\107\x49\x4e\40\103\105\122\124\x49\x46\111\103\101\x54\105\55\x2d\x2d\x2d\x2d\12" . chunk_split($WE, 64, "\xa") . "\x2d\x2d\x2d\x2d\55\x45\x4e\104\x20\x43\105\122\x54\x49\x46\x49\x43\x41\x54\x45\x2d\55\x2d\55\55\12";
                    $RB->loadKey($WE, false, true);
                    yt:
                    Lq:
                    goto ez;
            }
            w8:
            ez:
            xM:
        }
        XG:
        return $RB;
    }
    public function locateKeyInfo($RB = null, $c4 = null)
    {
        if (!empty($c4)) {
            goto Pt;
        }
        $c4 = $this->rawNode;
        Pt:
        return self::staticLocateKeyInfo($RB, $c4);
    }
}

Function Calls

None

Variables

None

Stats

MD5 a570ba6161b0617b5b865f73523742b5
Eval Count 0
Decode Time 105 ms