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 part of miniOrange SAML plugin that has all Utility class. *..
Decoded Output download
<?php
/**
* This file is part of miniOrange SAML plugin that has all Utility class.
*
* @link https://plugins.miniorange.com
* @author miniOrange
* @package miniorange-saml-20-single-sign-on
*/
include_once 'xmlseclibs.php';
use RobRichards\XMLSecLibs\XMLSecurityKey;
use RobRichards\XMLSecLibs\XMLSecurityDSig;
use RobRichards\XMLSecLibs\XMLSecEnc;
class Utilities
{
public static function generateID()
{
return "_" . self::stringToHex(self::generateRandomBytes(21));
}
public static function stringToHex($rI)
{
$dP = '';
$fN = 0;
VdX:
if (!($fN < strlen($rI))) {
goto X1V;
}
$dP .= sprintf("%02x", ord($rI[$fN]));
Bj1:
$fN++;
goto VdX;
X1V:
return $dP;
}
public static function generateRandomBytes($ev, $X_ = TRUE)
{
return openssl_random_pseudo_bytes($ev);
}
public static function createAuthnRequest($F5, $V4, $dg, $X5 = "false", $rj = "HttpRedirect", $vl = '')
{
$vl = "urn:oasis:names:tc:SAML:" . $vl;
$IK = "<?xml version="1.0" encoding="UTF-8"?>" . "<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="" . self::generateID() . "" Version="2.0" IssueInstant="" . self::generateTimestamp() . """;
if (!($X5 == "true")) {
goto rtn;
}
$IK .= " ForceAuthn="true"";
rtn:
$IK .= " ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="" . $F5 . "" Destination="" . $dg . ""><saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">" . $V4 . "</saml:Issuer><samlp:NameIDPolicy AllowCreate="true" Format="" . $vl . ""
\xa /></samlp:AuthnRequest>";
if (empty($rj) || $rj == "HttpRedirect") {
goto Ryx;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
update_site_option("mo_saml_request", $Uo);
goto lU8;
Ryx:
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
update_site_option("mo_saml_request", $Uo);
$oS = urlencode($Uo);
$IK = $oS;
lU8:
return $IK;
}
public static function createLogoutRequest($Be, $V4, $dg, $fC = '', $nM = "HttpRedirect")
{
$IK = "<?xml version="1.0" encoding="UTF-8"?>" . "<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="" . self::generateID() . "" IssueInstant="" . self::generateTimestamp() . "" Version="2.0" Destination="" . $dg . "">
\xa \x9\x9 \x9<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">" . $V4 . "</saml:Issuer>
\x9 <saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">" . $Be[0] . "</saml:NameID>";
if (empty($fC)) {
goto NA1;
}
$IK .= "<samlp:SessionIndex>" . $fC[0] . "</samlp:SessionIndex>";
NA1:
$IK .= "</samlp:LogoutRequest>";
if (!(empty($nM) || $nM == "HttpRedirect")) {
goto Rj1;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
$oS = urlencode($Uo);
$IK = $oS;
Rj1:
return $IK;
}
public static function createLogoutResponse($fd, $V4, $dg, $nM = "HttpRedirect")
{
$IK = "<?xml version="1.0" encoding="UTF-8"?>" . "<samlp:LogoutResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" " . "ID="" . self::generateID() . "" " . "Version="2.0" IssueInstant="" . self::generateTimestamp() . "" " . "Destination="" . $dg . "" " . "InResponseTo="" . $fd . "">" . "<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">" . $V4 . "</saml:Issuer>" . "<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status></samlp:LogoutResponse>";
if (!(empty($nM) || $nM == "HttpRedirect")) {
goto Vbl;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
$oS = urlencode($Uo);
$IK = $oS;
Vbl:
return $IK;
}
public static function generateTimestamp($fv = NULL)
{
if (!($fv === NULL)) {
goto JMP;
}
$fv = time();
JMP:
return gmdate("Y-m-d\TH:i:s\Z", $fv);
}
public static function xpQuery(DOMNode $EB, $HQ)
{
static $Yy = NULL;
if ($EB instanceof DOMDocument) {
goto ad1;
}
$Wq = $EB->ownerDocument;
goto xxN;
ad1:
$Wq = $EB;
xxN:
if (!($Yy === NULL || !$Yy->document->isSameNode($Wq))) {
goto CrR;
}
$Yy = new DOMXPath($Wq);
$Yy->registerNamespace("soap-env", "http://schemas.xmlsoap.org/soap/envelope/");
$Yy->registerNamespace("saml_protocol", "urn:oasis:names:tc:SAML:2.0:protocol");
$Yy->registerNamespace("saml_assertion", "urn:oasis:names:tc:SAML:2.0:assertion");
$Yy->registerNamespace("saml_metadata", "urn:oasis:names:tc:SAML:2.0:metadata");
$Yy->registerNamespace("ds", "http://www.w3.org/2000/09/xmldsig#");
$Yy->registerNamespace("xenc", "http://www.w3.org/2001/04/xmlenc#");
CrR:
$Gu = $Yy->query($HQ, $EB);
$dP = array();
$fN = 0;
SQO:
if (!($fN < $Gu->length)) {
goto AUg;
}
$dP[$fN] = $Gu->item($fN);
c0i:
$fN++;
goto SQO;
AUg:
return $dP;
}
public static function parseNameId(DOMElement $Yu)
{
$dP = array("Value" => trim($Yu->textContent));
foreach (array("NameQualifier", "SPNameQualifier", "Format") as $f7) {
if (!$Yu->hasAttribute($f7)) {
goto KIe;
}
$dP[$f7] = $Yu->getAttribute($f7);
KIe:
Lw3:
}
fjU:
return $dP;
}
public static function xsDateTimeToTimestamp($HX)
{
$oi = array();
$wY = "/^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(?:\.\d+)?Z$/D";
if (!(preg_match($wY, $HX, $oi) == 0)) {
goto O8a;
}
echo sprintf("nvalid SAML2 timestamp passed to xsDateTimeToTimestamp: " . $HX);
exit;
O8a:
$sT = intval($oi[1]);
$U2 = intval($oi[2]);
$tj = intval($oi[3]);
$dV = intval($oi[4]);
$Fq = intval($oi[5]);
$if = intval($oi[6]);
$dS = gmmktime($dV, $Fq, $if, $U2, $tj, $sT);
return $dS;
}
public static function extractStrings(DOMElement $Gs, $PP, $gm)
{
$dP = array();
$EB = $Gs->firstChild;
I_H:
if (!($EB !== NULL)) {
goto mSS;
}
if (!($EB->namespaceURI !== $PP || $EB->localName !== $gm)) {
goto rPS;
}
goto u5T;
rPS:
$dP[] = trim($EB->textContent);
u5T:
$EB = $EB->nextSibling;
goto I_H;
mSS:
return $dP;
}
public static function validateElement(DOMElement $zH)
{
$lI = new XMLSecurityDSig();
$lI->idKeys[] = "ID";
$We = self::xpQuery($zH, "./ds:Signature");
if (count($We) === 0) {
goto Cgp;
}
if (count($We) > 1) {
goto m2x;
}
goto Tdh;
Cgp:
return FALSE;
goto Tdh;
m2x:
echo sprintf("XMLSec: more than one signature element in root.");
exit;
Tdh:
$We = $We[0];
$lI->sigNode = $We;
$lI->canonicalizeSignedInfo();
if ($lI->validateReference()) {
goto gpJ;
}
echo sprintf("XMLsec: digest validation failed");
exit;
gpJ:
$Zn = FALSE;
foreach ($lI->getValidatedNodes() as $fc) {
if ($fc->isSameNode($zH)) {
goto xH3;
}
if ($zH->parentNode instanceof DOMDocument && $fc->isSameNode($zH->ownerDocument)) {
goto lct;
}
goto S4l;
xH3:
$Zn = TRUE;
goto QKL;
goto S4l;
lct:
$Zn = TRUE;
goto QKL;
S4l:
R7Z:
}
QKL:
if ($Zn) {
goto Ksf;
}
echo sprintf("XMLSec: The root element is not signed.");
exit;
Ksf:
$kh = array();
foreach (self::xpQuery($We, "./ds:KeyInfo/ds:X509Data/ds:X509Certificate") as $cN) {
$kC = trim($cN->textContent);
$kC = str_replace(array("
", "
", " ", " "), '', $kC);
$kh[] = $kC;
cyb:
}
JUi:
$dP = array("Signature" => $lI, "Certificates" => $kh);
return $dP;
}
public static function validateSignature(array $qT, XMLSecurityKey $tK)
{
$lI = $qT["Signature"];
$er = self::xpQuery($lI->sigNode, "./ds:SignedInfo/ds:SignatureMethod");
if (!empty($er)) {
goto Dg3;
}
echo sprintf("Missing SignatureMethod element");
exit;
Dg3:
$er = $er[0];
if ($er->hasAttribute("Algorithm")) {
goto XTr;
}
echo sprintf("Missing Algorithm-attribute on SignatureMethod element.");
exit;
XTr:
$uP = $er->getAttribute("Algorithm");
if (!($tK->type === XMLSecurityKey::RSA_SHA1 && $uP !== $tK->type)) {
goto GtP;
}
$tK = self::castKey($tK, $uP);
GtP:
if ($lI->verify($tK)) {
goto W99;
}
return false;
W99:
}
public static function castKey(XMLSecurityKey $tK, $rv, $Ks = "public")
{
if (!($tK->type === $rv)) {
goto M8K;
}
return $tK;
M8K:
$Jh = openssl_pkey_get_details($tK->key);
if (!($Jh === FALSE)) {
goto XL9;
}
echo sprintf("Unable to get key details from XMLSecurityKey.");
exit;
XL9:
if (!empty($Jh["key"])) {
goto rZ8;
}
echo sprintf("Missing key in public key details.");
exit;
rZ8:
$hA = new XMLSecurityKey($rv, array("type" => $Ks));
$hA->loadKey($Jh["key"]);
return $hA;
}
public static function processResponse($V2, $q6, $Nl, SAML2_Response $ZT, $SH, $Na)
{
$Gr = current($ZT->getAssertions());
$A9 = $Gr->getNotBefore();
if (!($A9 !== NULL && $A9 > time() + 60)) {
goto Bbe;
}
wp_die("Received an assertion that is valid in the future. Check clock synchronization on IdP and SP.");
Bbe:
$F3 = $Gr->getNotOnOrAfter();
if (!($F3 !== NULL && $F3 <= time() - 60)) {
goto ere;
}
wp_die("Received an assertion that has expired. Check clock synchronization on IdP and SP.");
ere:
$mt = $Gr->getSessionNotOnOrAfter();
if (!($mt !== NULL && $mt <= time() - 60)) {
goto B_T;
}
wp_die("Received an assertion with a session that has expired. Check clock synchronization on IdP and SP.");
B_T:
$qX = $ZT->getDestination();
if (!(substr($qX, -1) == "/")) {
goto x2z;
}
$qX = substr($qX, 0, -1);
x2z:
if (!(substr($V2, -1) == "/")) {
goto B0Z;
}
$V2 = substr($V2, 0, -1);
B0Z:
if (!($qX !== NULL && $qX !== $V2)) {
goto RqS;
}
echo "Destination in response doesn't match the current URL. Destination is "" . htmlspecialchars($qX) . "", current URL is "" . htmlspecialchars($V2) . "".";
exit;
RqS:
$Fw = self::checkSign($q6, $Nl, $SH, $Na);
return $Fw;
}
public static function checkSign($q6, $Nl, $SH, $Na)
{
$kh = $Nl["Certificates"];
if (count($kh) === 0) {
goto Q3x;
}
$kn = array();
$kn[] = $q6;
$es = self::findCertificate($kn, $kh, $Na);
if ($es) {
goto viI;
}
return FALSE;
viI:
goto S9z;
Q3x:
$zd = maybe_unserialize(get_site_option("saml_x509_certificate"));
$es = $zd[$SH];
S9z:
$Gp = NULL;
$tK = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array("type" => "public"));
$tK->loadKey($es);
try {
self::validateSignature($Nl, $tK);
return TRUE;
} catch (Exception $J_) {
$Gp = $J_;
return FALSE;
}
if ($Gp !== NULL) {
goto HPn;
}
return FALSE;
goto Onn;
HPn:
throw $Gp;
Onn:
}
public static function validateIssuerAndAudience($k4, $Mp, $H0, $Na)
{
$V4 = current($k4->getAssertions())->getIssuer();
$Gr = current($k4->getAssertions());
$T7 = $Gr->getValidAudiences();
if (strcmp($H0, $V4) === 0) {
goto u8b;
}
if ($Na == "testValidate" or $Na == "testNewCertificate") {
goto eNB;
}
wp_die("We could not sign you in. Please contact your Administrator", "Error :Issuer cannot be verified");
goto C5X;
eNB:
ob_end_clean();
$I7 = mo_options_error_constants::Error_issuer_not_verfied;
$xa = mo_options_error_constants::Cause_issuer_not_verfied;
echo "<div style="font-family:Calibri;padding:0 3%;">";
echo "<div style="color: #a94442;background-color: #f2dede;padding: 15px;margin-bottom: 20px;text-align:center;border:1px solid #E6B3B2;font-size:18pt;"> ERROR</div>
\x9\x9 <div style="color: #a94442;font-size:14pt; margin-bottom:20px;"><p><strong>Error: </strong>Issuer cannot be verified.</p>\xd\xa \x9\x9 <p>Please contact your administrator and report the following error:</p>\xd\xa \x9\x9 <p><strong>Possible Cause: </strong>IdP Entity ID configured in the plugin is incorrect</p>\xd
\x9 <p><strong>Entity ID in SAML Response: </strong>" . esc_html($V4) . "<p>\xd
\x9 \x9 <p><strong>Entity ID configured in the plugin: </strong>" . esc_html($H0) . "</p>
\xa \x9\x9 <p><strong>Solution:</strong></p>\xd\xa \x9\x9\x9<ol>
\xa \x9 \x9<li>Copy the Entity ID of SAML Response from above and paste it in Entity ID or Issuer field under Service Provider Setup tab.</li>\xd
\x9</ol>\xd\xa \x9 </div>
\x9 <div style="margin:3%;display:block;text-align:center;">\xd
\x9 \x9 <div style="margin:3%;display:block;text-align:center;"><input style="padding:1%;width:100px;background: #0091CD none repeat scroll 0% 0%;cursor: pointer;font-size:15px;border-width: 1px;border-style: solid;border-radius: 3px;white-space: nowrap;box-sizing: border-box;border-color: #0073AA;box-shadow: 0px 1px 0px rgba(120, 200, 230, 0.6) inset;color: #FFF;"type="button" value="Done" onClick="self.close();"></div>";
mo_saml_download_logs($I7, $xa);
exit;
C5X:
goto X1d;
u8b:
if (empty($T7)) {
goto H0C;
}
if (self::mo_saml_in_array($Mp, $T7, TRUE)) {
goto mPs;
}
if ($Na == "testValidate" or $Na == "testNewCertificate") {
goto DZZ;
}
wp_die("We could not sign you in. Please contact your Administrator", "Error :Invalid Audience URI");
goto mTj;
DZZ:
$I7 = mo_options_error_constants::Error_invalid_audience;
$xa = mo_options_error_constants::Cause_invalid_audience;
ob_end_clean();
echo "<div style="font-family:Calibri;padding:0 3%;">";
echo "<div style="color: #a94442;background-color: #f2dede;padding: 15px;margin-bottom: 20px;text-align:center;border:1px solid #E6B3B2;font-size:18pt;"> ERROR</div>\xd
<div style="color: #a94442;font-size:14pt; margin-bottom:20px;"><p><strong>Error: </strong>Invalid Audience URI.</p>\xd
<p>Please contact your administrator and report the following error:</p>\xd
<p><strong>Possible Cause: </strong>The value of 'Audience URI' field on Identity Provider's side is incorrect</p>\xd\xa <p>Expected one of the Audiences to be: " . $Mp . "<p>\xd
\x9 <p><strong>Solution:</strong></p>\xd
\x9\x9 <ol>\xd
\x9 \x9\x9\x9\x9<li>Copy the Expected Audience URI from above and paste it in the Audience URI field at Identity Provider side.</li>\xd
\x9\x9</ol>
\xa \x9\x9\x9 </div>\xd
<div style="margin:3%;display:block;text-align:center;">
\xa <div style="margin:3%;display:block;text-align:center;"><input style="padding:1%;width:100px;background: #0091CD none repeat scroll 0% 0%;cursor: pointer;font-size:15px;border-width: 1px;border-style: solid;border-radius: 3px;white-space: nowrap;box-sizing: border-box;border-color: #0073AA;box-shadow: 0px 1px 0px rgba(120, 200, 230, 0.6) inset;color: #FFF;"type="button" value="Done" onClick="self.close();"></div>";
exit;
mo_saml_download_logs($I7, $xa);
mTj:
goto oTP;
mPs:
return TRUE;
oTP:
H0C:
X1d:
}
private static function findCertificate(array $Gl, array $kh, $Na)
{
$dF = array();
foreach ($kh as $wh) {
$am = strtolower(sha1(base64_decode($wh)));
if (!self::mo_saml_in_array($am, $Gl, TRUE)) {
goto SEQ;
}
$BZ = "-----BEGIN CERTIFICATE-----
" . chunk_split($wh, 64) . "-----END CERTIFICATE-----\xa";
return $BZ;
SEQ:
$dF[] = $am;
Jgc:
}
OEH:
return false;
}
private static function doDecryptElement(DOMElement $TY, XMLSecurityKey $nk, array &$Ac)
{
$to = new XMLSecEnc();
$to->setNode($TY);
$to->type = $TY->getAttribute("Type");
$cn = $to->locateKey($TY);
if ($cn) {
goto vMX;
}
echo sprintf("Could not locate key algorithm in encrypted data.");
exit;
vMX:
$Dn = $to->locateKeyInfo($cn);
if ($Dn) {
goto SQl;
}
echo sprintf("Could not locate <dsig:KeyInfo> for the encrypted key.");
exit;
SQl:
$f0 = $nk->getAlgorith();
if ($Dn->isEncrypted) {
goto NwF;
}
$YJ = $cn->getAlgorith();
if (!($f0 !== $YJ)) {
goto QOj;
}
echo sprintf("Algorithm mismatch between input key and key in message. " . "Key was: " . var_export($f0, TRUE) . "; message was: " . var_export($YJ, TRUE));
exit;
QOj:
$cn = $nk;
goto cm0;
NwF:
$CG = $Dn->getAlgorith();
if (!self::mo_saml_in_array($CG, $Ac, TRUE)) {
goto Rnc;
}
echo sprintf("Algorithm disabled: " . var_export($CG, TRUE));
exit;
Rnc:
if (!($CG === XMLSecurityKey::RSA_OAEP_MGF1P && $f0 === XMLSecurityKey::RSA_1_5)) {
goto BGy;
}
$f0 = XMLSecurityKey::RSA_OAEP_MGF1P;
BGy:
if (!($f0 !== $CG)) {
goto bYM;
}
echo sprintf("Algorithm mismatch between input key and key used to encrypt " . " the symmetric key for the message. Key was: " . var_export($f0, TRUE) . "; message was: " . var_export($CG, TRUE));
exit;
bYM:
$Nq = $Dn->encryptedCtx;
$Dn->key = $nk->key;
$M3 = $cn->getSymmetricKeySize();
if (!($M3 === NULL)) {
goto hF3;
}
echo sprintf("Unknown key size for encryption algorithm: " . var_export($cn->type, TRUE));
exit;
hF3:
try {
$tK = $Nq->decryptKey($Dn);
if (!(strlen($tK) != $M3)) {
goto ska;
}
echo sprintf("Unexpected key size (" . strlen($tK) * 8 . "bits) for encryption algorithm: " . var_export($cn->type, TRUE));
exit;
ska:
} catch (Exception $J_) {
$yr = $Nq->getCipherValue();
$oE = openssl_pkey_get_details($Dn->key);
$oE = sha1(serialize($oE), TRUE);
$tK = sha1($yr . $oE, TRUE);
if (strlen($tK) > $M3) {
goto O7q;
}
if (strlen($tK) < $M3) {
goto RxI;
}
goto zRr;
O7q:
$tK = substr($tK, 0, $M3);
goto zRr;
RxI:
$tK = str_pad($tK, $M3);
zRr:
}
$cn->loadkey($tK);
cm0:
$rv = $cn->getAlgorith();
if (!self::mo_saml_in_array($rv, $Ac, TRUE)) {
goto wes;
}
echo sprintf("Algorithm disabled: " . var_export($rv, TRUE));
exit;
wes:
$Rd = $to->decryptNode($cn, FALSE);
$Yu = "<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" " . "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">" . $Rd . "</root>";
$cR = new DOMDocument();
if (@$cR->loadXML($Yu)) {
goto a6Y;
}
echo sprintf("Failed to parse decrypted XML. Maybe the wrong sharedkey was used?");
throw new Exception("Failed to parse decrypted XML. Maybe the wrong sharedkey was used?");
a6Y:
$Dx = $cR->firstChild->firstChild;
if (!($Dx === NULL)) {
goto wHg;
}
echo sprintf("Missing encrypted element.");
throw new Exception("Missing encrypted element.");
wHg:
if ($Dx instanceof DOMElement) {
goto KJT;
}
echo sprintf("Decrypted element was not actually a DOMElement.");
KJT:
return $Dx;
}
public static function decryptElement(DOMElement $TY, XMLSecurityKey $nk, array $Ac = array(), XMLSecurityKey $qd = NULL)
{
try {
return self::doDecryptElement($TY, $nk, $Ac);
} catch (Exception $J_) {
echo sprintf("Failed to decrypt XML element.");
exit;
}
}
public static function get_mapped_groups($N4, $jM)
{
$y9 = array();
if (empty($jM)) {
goto Dlq;
}
$ZD = array();
$fN = 1;
EMU:
if (!($fN < 10)) {
goto HqO;
}
$KD = $N4->get("group" . $fN . "_map");
$ZD[$fN] = explode(";", $KD);
$fN++;
goto EMU;
HqO:
Dlq:
foreach ($jM as $Cf) {
if (empty($Cf)) {
goto g9n;
}
$fN = 0;
$ra = false;
m4k:
if (!($fN < 9 && !$ra)) {
goto IRN;
}
if (!(!empty($ZD[$fN]) && in_array($Cf, $ZD[$fN]))) {
goto JBa;
}
$y9[] = $N4->get("group" . $fN);
$ra = true;
JBa:
$fN++;
goto m4k;
IRN:
g9n:
mow:
}
ARZ:
return array_unique($y9);
}
public static function getEncryptionAlgorithm($I5)
{
switch ($I5) {
case "http://www.w3.org/2001/04/xmlenc#tripledes-cbc":
return XMLSecurityKey::TRIPLEDES_CBC;
goto KbW;
case "http://www.w3.org/2001/04/xmlenc#aes128-cbc":
return XMLSecurityKey::AES128_CBC;
case "http://www.w3.org/2001/04/xmlenc#aes192-cbc":
return XMLSecurityKey::AES192_CBC;
goto KbW;
case "http://www.w3.org/2001/04/xmlenc#aes256-cbc":
return XMLSecurityKey::AES256_CBC;
goto KbW;
case "http://www.w3.org/2001/04/xmlenc#rsa-1_5":
return XMLSecurityKey::RSA_1_5;
goto KbW;
case "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p":
return XMLSecurityKey::RSA_OAEP_MGF1P;
goto KbW;
case "http://www.w3.org/2000/09/xmldsig#dsa-sha1":
return XMLSecurityKey::DSA_SHA1;
goto KbW;
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
return XMLSecurityKey::RSA_SHA1;
goto KbW;
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":
return XMLSecurityKey::RSA_SHA256;
goto KbW;
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384":
return XMLSecurityKey::RSA_SHA384;
goto KbW;
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":
return XMLSecurityKey::RSA_SHA512;
goto KbW;
default:
echo sprintf("Invalid Encryption Method: " . $I5);
exit;
goto KbW;
}
qmM:
KbW:
}
public static function insertSignature(XMLSecurityKey $tK, array $kh, DOMElement $zH, DOMNode $y_ = NULL)
{
$lI = new XMLSecurityDSig();
$lI->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
switch ($tK->type) {
case XMLSecurityKey::RSA_SHA256:
$Ks = XMLSecurityDSig::SHA256;
goto JPd;
case XMLSecurityKey::RSA_SHA384:
$Ks = XMLSecurityDSig::SHA384;
goto JPd;
case XMLSecurityKey::RSA_SHA512:
$Ks = XMLSecurityDSig::SHA512;
goto JPd;
default:
$Ks = XMLSecurityDSig::SHA1;
}
iJP:
JPd:
$lI->addReferenceList(array($zH), $Ks, array("http://www.w3.org/2000/09/xmldsig#enveloped-signature", XMLSecurityDSig::EXC_C14N), array("id_name" => "ID", "overwrite" => FALSE));
$lI->sign($tK);
foreach ($kh as $gS) {
$lI->add509Cert($gS, TRUE);
c0f:
}
CB_:
$lI->insertSignature($zH, $y_);
}
public static function getRemainingDaysOfCurrentCertificate()
{
$gS = get_site_option("mo_saml_current_cert");
$sd = openssl_x509_parse($gS);
$Kc = $sd["validTo_time_t"];
$Bt = $Kc - time();
return round($Bt / (60 * 60 * 24));
}
public static function getExpiryDateOfCurrentCertificate()
{
$gS = get_site_option("mo_saml_current_cert");
$sd = openssl_x509_parse($gS);
return $sd["validTo_time_t"];
}
public static function getValidUntilDateFromCert($gS)
{
$sd = openssl_x509_parse($gS);
$Kc = $sd["validTo_time_t"];
$kW = date("Y-m-d", $Kc);
$pC = $kW . "T23:59:59Z";
return $pC;
}
public static function signXML($Yu, $b8 = '', $mb = false)
{
$Cv = array("type" => "private");
$tK = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, $Cv);
if ($mb) {
goto Zle;
}
$pH = get_site_option("mo_saml_current_cert_private_key");
$cy = get_site_option("mo_saml_current_cert");
goto ePi;
Zle:
$pH = file_get_contents(plugin_dir_path(__FILE__) . "resources" . DIRECTORY_SEPARATOR . mo_options_enum_default_sp_certificate::SP_Private_Key);
$cy = file_get_contents(plugin_dir_path(__FILE__) . "resources" . DIRECTORY_SEPARATOR . mo_options_enum_default_sp_certificate::SP_Public_Certificate);
ePi:
$tK->loadKey($pH, FALSE);
$Hr = new DOMDocument();
$Hr->loadXML($Yu);
$CL = $Hr->firstChild;
if (!empty($b8)) {
goto LUG;
}
self::insertSignature($tK, array($cy), $CL);
goto k8z;
LUG:
$W1 = $Hr->getElementsByTagName($b8)->item(0);
self::insertSignature($tK, array($cy), $CL, $W1);
k8z:
$rA = $CL->ownerDocument->saveXML($CL);
$RL = base64_encode($rA);
return $RL;
}
public static function postSAMLRequest($tX, $GM, $Na)
{
echo "<html><body>Please wait...<form action="" . $tX . "" method="post" id="saml-request-form"><input type="hidden" name="SAMLRequest" value="" . $GM . "" /><input type="hidden" name="RelayState" value="" . htmlentities($Na) . "" /></form><script>document.getElementById('saml-request-form').submit();</script></body></html>";
exit;
}
public static function postSAMLResponse($tX, $y8, $Na)
{
echo "<html><body>Please wait...<form action="" . $tX . "" method="post" id="saml-response-form"><input type="hidden" name="SAMLResponse" value="" . $y8 . "" /><input type="hidden" name="RelayState" value="" . htmlentities($Na) . "" /></form><script>document.getElementById('saml-response-form').submit();</script></body></html>";
exit;
}
public static function sanitize_certificate($gS)
{
$gS = preg_replace("/[\xd\xa]+/", '', $gS);
$gS = str_replace("-", '', $gS);
$gS = str_replace("BEGIN CERTIFICATE", '', $gS);
$gS = str_replace("END CERTIFICATE", '', $gS);
$gS = str_replace(" ", '', $gS);
$gS = chunk_split($gS, 64, "
");
$gS = "-----BEGIN CERTIFICATE-----\xd
" . $gS . "-----END CERTIFICATE-----";
return $gS;
}
public static function desanitize_certificate($gS)
{
$gS = preg_replace("/[\xd
]+/", '', $gS);
$gS = str_replace("-----BEGIN CERTIFICATE-----", '', $gS);
$gS = str_replace("-----END CERTIFICATE-----", '', $gS);
$gS = str_replace(" ", '', $gS);
return $gS;
}
public static function get_sites()
{
$rn = array("network_id" => null, "public" => null, "archived" => 0, "mature" => null, "spam" => 0, "deleted" => 0, "number" => 0, "offset" => 0);
if (function_exists("get_sites") && class_exists("WP_Site_Query")) {
goto cNx;
}
if (!function_exists("wp_get_sites")) {
goto zy3;
}
$oL = wp_get_sites($rn);
zy3:
goto f9A;
cNx:
$oL = get_sites($rn);
f9A:
return $oL;
}
public static function get_active_sites()
{
$na = maybe_unserialize(get_site_option("mo_enable_sso_sites"));
if (!empty($na)) {
goto j02;
}
$na = array();
$oL = self::get_sites();
foreach ($oL as $Qu) {
array_push($na, $Qu->blog_id);
pRB:
}
y_S:
j02:
$xA = self::get_main_subsite_id();
if (self::mo_saml_in_array($xA, $na)) {
goto hyF;
}
array_push($na, $xA);
hyF:
return $na;
}
public static function get_all_roles()
{
$oL = self::get_sites();
$gZ = array();
foreach ($oL as $Qu) {
$EQ = new WP_Roles($Qu->blog_id);
$JM = $EQ->get_names();
$gZ = array_merge($gZ, $JM);
jSz:
}
GZg:
return $gZ;
}
public static function get_main_subsite_id()
{
$oL = self::get_sites();
$Eq = get_site_option("mo_saml_sp_base_url");
if (!empty($Eq)) {
goto qj5;
}
$Eq = get_network_site_url();
qj5:
$F5 = $Eq . "/";
$gL = parse_url($Eq, PHP_URL_SCHEME);
$F5 = str_replace($gL . "://", '', $F5);
$Ui = 1;
foreach ($oL as $Qu) {
$no = $Qu->domain . $Qu->path;
if (!($no == $F5)) {
goto HIK;
}
$Ui = $Qu->blog_id;
HIK:
FET:
}
Mtc:
return $Ui;
}
public static function mo_saml_wp_remote_call($tX, $kY, $rn = array(), $WJ = false)
{
if (!$WJ) {
goto rCz;
}
$ZT = wp_remote_get($tX, $rn);
goto CSM;
rCz:
$ZT = wp_remote_post($tX, $rn);
CSM:
if (!is_wp_error($ZT)) {
goto G2f;
}
$T2 = $kY;
update_option("mo_saml_message", "Unable to connect to the Internet. Please try again.");
$T2->mo_saml_show_error_message();
return false;
goto PBl;
G2f:
return $ZT["body"];
PBl:
}
public static function mo_saml_in_array($tK, $Ed, $Fl = false)
{
if (!(is_array($Ed) and in_array($tK, $Ed, $Fl))) {
goto CD6;
}
return true;
CD6:
return false;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* This file is part of miniOrange SAML plugin that has all Utility class.
*
* @link https://plugins.miniorange.com
* @author miniOrange
* @package miniorange-saml-20-single-sign-on
*/
include_once 'xmlseclibs.php';
use RobRichards\XMLSecLibs\XMLSecurityKey;
use RobRichards\XMLSecLibs\XMLSecurityDSig;
use RobRichards\XMLSecLibs\XMLSecEnc;
class Utilities
{
public static function generateID()
{
return "\137" . self::stringToHex(self::generateRandomBytes(21));
}
public static function stringToHex($rI)
{
$dP = '';
$fN = 0;
VdX:
if (!($fN < strlen($rI))) {
goto X1V;
}
$dP .= sprintf("\x25\x30\62\170", ord($rI[$fN]));
Bj1:
$fN++;
goto VdX;
X1V:
return $dP;
}
public static function generateRandomBytes($ev, $X_ = TRUE)
{
return openssl_random_pseudo_bytes($ev);
}
public static function createAuthnRequest($F5, $V4, $dg, $X5 = "\x66\141\x6c\x73\x65", $rj = "\110\x74\164\x70\122\145\144\151\162\x65\x63\x74", $vl = '')
{
$vl = "\x75\162\x6e\72\x6f\x61\163\x69\x73\x3a\156\141\155\x65\x73\x3a\164\x63\72\x53\x41\115\114\x3a" . $vl;
$IK = "\74\77\x78\155\x6c\x20\166\145\x72\x73\151\157\156\x3d\x22\x31\x2e\x30\42\x20\145\x6e\143\157\144\x69\156\x67\x3d\x22\125\x54\106\55\70\42\77\x3e" . "\x3c\x73\141\155\154\160\72\101\165\x74\x68\x6e\x52\x65\x71\x75\x65\163\164\x20\170\x6d\x6c\156\163\x3a\163\x61\x6d\x6c\x70\75\42\165\162\x6e\x3a\157\141\163\151\x73\x3a\x6e\141\155\145\163\72\164\143\72\x53\101\115\x4c\x3a\62\x2e\60\72\x70\x72\157\x74\x6f\143\157\x6c\42\40\170\x6d\154\156\163\75\42\165\162\x6e\x3a\157\x61\163\151\x73\x3a\156\x61\155\145\163\72\x74\143\x3a\123\101\115\x4c\x3a\62\x2e\60\x3a\x61\x73\163\x65\x72\x74\x69\157\x6e\x22\40\111\104\x3d\x22" . self::generateID() . "\42\40\x56\x65\162\163\151\157\x6e\75\x22\x32\x2e\60\x22\x20\111\x73\163\x75\145\x49\156\163\164\x61\156\x74\x3d\x22" . self::generateTimestamp() . "\42";
if (!($X5 == "\x74\x72\165\145")) {
goto rtn;
}
$IK .= "\40\x46\x6f\162\x63\145\x41\165\164\150\x6e\x3d\42\x74\x72\x75\x65\42";
rtn:
$IK .= "\x20\120\x72\157\164\157\143\x6f\x6c\102\151\156\x64\x69\156\147\x3d\42\x75\x72\156\x3a\x6f\x61\x73\x69\x73\72\156\x61\155\x65\163\x3a\x74\x63\72\123\101\x4d\114\72\62\56\x30\72\x62\x69\x6e\144\151\x6e\147\163\x3a\110\124\124\x50\55\120\117\x53\x54\42\40\x41\163\163\145\x72\164\151\x6f\x6e\103\x6f\x6e\x73\x75\x6d\x65\x72\x53\x65\162\166\151\143\145\x55\122\x4c\x3d\x22" . $F5 . "\42\x20\x44\x65\163\164\151\156\141\164\151\x6f\156\75\42" . $dg . "\x22\76\x3c\163\141\155\154\72\111\x73\163\x75\145\162\x20\170\155\x6c\x6e\x73\72\x73\141\x6d\x6c\x3d\42\165\x72\x6e\72\157\141\x73\151\x73\x3a\x6e\x61\x6d\x65\x73\x3a\164\x63\x3a\123\x41\115\x4c\x3a\62\x2e\60\72\x61\163\x73\x65\162\164\x69\157\156\x22\76" . $V4 . "\x3c\57\163\x61\x6d\x6c\x3a\111\163\163\165\x65\x72\76\x3c\163\x61\x6d\x6c\x70\x3a\116\x61\x6d\145\x49\104\120\157\x6c\x69\x63\171\40\101\154\x6c\157\167\x43\162\145\141\164\145\x3d\42\x74\162\165\145\x22\x20\106\x6f\x72\x6d\141\164\x3d\x22" . $vl . "\42\15\xa\40\x20\40\x20\40\x20\x20\x20\40\40\x20\40\x20\40\x20\40\x20\40\40\40\40\x20\x20\40\57\x3e\x3c\x2f\163\141\x6d\x6c\x70\72\101\165\164\150\x6e\x52\x65\x71\x75\x65\163\x74\76";
if (empty($rj) || $rj == "\x48\164\x74\160\x52\145\144\x69\x72\x65\143\164") {
goto Ryx;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
update_site_option("\x6d\x6f\x5f\163\x61\155\x6c\x5f\162\145\x71\x75\x65\x73\x74", $Uo);
goto lU8;
Ryx:
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
update_site_option("\155\157\x5f\x73\141\155\154\137\162\x65\161\165\145\163\x74", $Uo);
$oS = urlencode($Uo);
$IK = $oS;
lU8:
return $IK;
}
public static function createLogoutRequest($Be, $V4, $dg, $fC = '', $nM = "\110\x74\164\160\122\x65\144\151\162\x65\x63\x74")
{
$IK = "\74\77\x78\x6d\x6c\40\166\x65\x72\163\151\x6f\x6e\x3d\42\x31\x2e\x30\x22\x20\x65\x6e\x63\157\x64\x69\x6e\147\x3d\42\x55\124\x46\x2d\x38\x22\x3f\76" . "\x3c\163\141\x6d\154\160\72\x4c\157\147\x6f\165\164\x52\145\161\x75\x65\x73\x74\40\x78\x6d\154\156\x73\72\163\141\155\x6c\x70\x3d\x22\x75\x72\156\x3a\x6f\141\163\x69\163\72\156\x61\155\145\163\x3a\164\x63\x3a\123\x41\115\x4c\x3a\62\x2e\60\x3a\x70\162\157\x74\x6f\x63\157\x6c\42\40\170\155\154\156\163\x3a\163\x61\x6d\154\x3d\42\165\162\156\x3a\157\141\163\151\x73\72\156\141\x6d\145\163\72\164\x63\x3a\x53\x41\x4d\x4c\72\x32\x2e\60\72\141\163\x73\x65\162\x74\x69\157\156\42\40\x49\104\x3d\x22" . self::generateID() . "\x22\x20\111\163\163\165\145\111\156\x73\x74\x61\156\x74\x3d\42" . self::generateTimestamp() . "\42\x20\126\145\162\163\x69\157\156\x3d\42\x32\x2e\60\42\x20\104\x65\x73\x74\151\x6e\141\x74\x69\157\156\75\x22" . $dg . "\42\x3e\15\xa\11\x9\x9\11\11\x9\x3c\163\141\x6d\x6c\72\x49\x73\x73\165\145\162\x20\170\155\x6c\x6e\163\x3a\163\x61\x6d\x6c\x3d\x22\165\162\x6e\72\157\141\163\x69\x73\x3a\156\x61\155\x65\163\72\x74\143\72\x53\x41\115\x4c\72\62\56\60\72\x61\x73\163\145\162\164\151\x6f\x6e\x22\x3e" . $V4 . "\74\57\x73\x61\x6d\x6c\72\111\163\163\165\x65\162\x3e\15\12\11\11\11\11\x9\11\74\163\141\x6d\x6c\x3a\116\x61\155\145\x49\x44\40\170\155\154\156\163\x3a\163\x61\x6d\x6c\75\x22\165\x72\x6e\72\157\141\163\x69\x73\72\x6e\141\155\x65\163\x3a\164\143\x3a\123\101\x4d\114\72\x32\56\x30\x3a\x61\x73\163\x65\x72\x74\151\x6f\x6e\42\76" . $Be[0] . "\x3c\x2f\x73\x61\155\x6c\72\x4e\x61\155\x65\x49\x44\x3e";
if (empty($fC)) {
goto NA1;
}
$IK .= "\74\163\141\x6d\x6c\x70\72\x53\145\x73\x73\151\x6f\156\111\x6e\x64\145\170\76" . $fC[0] . "\74\x2f\x73\141\x6d\x6c\x70\72\123\x65\x73\163\x69\x6f\x6e\x49\x6e\144\145\170\76";
NA1:
$IK .= "\x3c\x2f\x73\x61\x6d\154\160\x3a\x4c\x6f\x67\x6f\x75\164\122\x65\x71\x75\145\163\164\x3e";
if (!(empty($nM) || $nM == "\x48\x74\x74\160\x52\145\144\x69\162\x65\x63\x74")) {
goto Rj1;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
$oS = urlencode($Uo);
$IK = $oS;
Rj1:
return $IK;
}
public static function createLogoutResponse($fd, $V4, $dg, $nM = "\110\164\164\160\122\145\144\151\x72\x65\143\x74")
{
$IK = "\74\x3f\170\x6d\154\40\x76\x65\162\163\x69\157\156\x3d\x22\x31\56\x30\x22\x20\145\x6e\x63\x6f\x64\x69\x6e\147\75\x22\x55\124\106\x2d\70\42\x3f\76" . "\74\163\x61\155\154\x70\x3a\x4c\157\147\x6f\x75\x74\122\x65\163\160\x6f\156\163\145\40\x78\x6d\x6c\x6e\x73\72\163\141\x6d\x6c\160\75\x22\x75\x72\156\x3a\157\x61\163\151\163\72\156\141\155\145\x73\x3a\x74\x63\x3a\123\x41\115\114\x3a\62\x2e\60\72\160\162\157\x74\157\x63\x6f\x6c\x22\40\170\x6d\154\x6e\x73\x3a\163\141\155\154\x3d\x22\x75\x72\x6e\72\157\x61\163\x69\163\x3a\x6e\x61\x6d\145\x73\72\164\x63\72\x53\x41\x4d\x4c\x3a\x32\x2e\x30\72\141\163\163\145\162\164\151\x6f\x6e\42\40" . "\x49\x44\75\x22" . self::generateID() . "\42\40" . "\126\145\x72\163\151\x6f\x6e\75\x22\62\x2e\x30\42\x20\x49\163\163\165\145\111\x6e\163\x74\141\x6e\164\x3d\42" . self::generateTimestamp() . "\x22\x20" . "\104\145\x73\x74\151\156\141\x74\x69\157\x6e\75\x22" . $dg . "\x22\x20" . "\x49\x6e\122\x65\163\160\157\156\163\145\x54\157\x3d\42" . $fd . "\x22\x3e" . "\x3c\x73\141\x6d\x6c\72\111\x73\x73\165\x65\162\40\x78\x6d\154\156\x73\x3a\x73\x61\x6d\154\75\42\165\x72\x6e\72\157\x61\163\151\163\x3a\x6e\141\155\145\x73\x3a\164\x63\72\x53\101\115\114\x3a\x32\56\x30\x3a\141\163\163\x65\162\x74\151\x6f\156\x22\76" . $V4 . "\x3c\x2f\163\141\x6d\x6c\x3a\111\x73\163\x75\x65\162\x3e" . "\x3c\x73\141\155\x6c\x70\72\123\164\141\164\165\x73\x3e\74\x73\141\155\154\160\72\x53\164\141\164\165\x73\x43\x6f\144\x65\40\126\x61\154\x75\145\x3d\42\x75\162\156\x3a\x6f\141\x73\x69\163\x3a\x6e\141\x6d\x65\x73\72\164\143\x3a\x53\101\115\114\x3a\x32\56\60\72\163\x74\141\164\165\x73\72\123\x75\x63\x63\x65\x73\x73\42\x2f\x3e\x3c\x2f\163\141\x6d\x6c\x70\72\x53\x74\x61\164\x75\x73\x3e\74\57\x73\x61\155\154\x70\72\x4c\x6f\x67\x6f\x75\164\122\145\163\160\x6f\156\x73\x65\76";
if (!(empty($nM) || $nM == "\x48\164\x74\160\122\145\x64\151\x72\x65\x63\x74")) {
goto Vbl;
}
$Rx = gzdeflate($IK);
$Uo = base64_encode($Rx);
$oS = urlencode($Uo);
$IK = $oS;
Vbl:
return $IK;
}
public static function generateTimestamp($fv = NULL)
{
if (!($fv === NULL)) {
goto JMP;
}
$fv = time();
JMP:
return gmdate("\x59\x2d\x6d\55\x64\134\124\110\72\151\72\x73\x5c\x5a", $fv);
}
public static function xpQuery(DOMNode $EB, $HQ)
{
static $Yy = NULL;
if ($EB instanceof DOMDocument) {
goto ad1;
}
$Wq = $EB->ownerDocument;
goto xxN;
ad1:
$Wq = $EB;
xxN:
if (!($Yy === NULL || !$Yy->document->isSameNode($Wq))) {
goto CrR;
}
$Yy = new DOMXPath($Wq);
$Yy->registerNamespace("\163\157\x61\160\55\x65\x6e\x76", "\150\x74\164\x70\72\57\x2f\163\x63\x68\145\x6d\x61\x73\56\170\155\154\163\157\141\x70\x2e\157\x72\147\x2f\163\x6f\x61\160\x2f\x65\156\166\145\x6c\157\x70\x65\x2f");
$Yy->registerNamespace("\x73\x61\155\154\x5f\x70\162\157\x74\157\x63\157\154", "\165\162\156\x3a\157\x61\163\151\x73\72\156\141\155\x65\x73\x3a\164\x63\x3a\123\x41\x4d\x4c\x3a\62\56\x30\72\x70\x72\x6f\x74\x6f\x63\x6f\x6c");
$Yy->registerNamespace("\x73\x61\155\x6c\137\141\163\163\x65\162\164\x69\x6f\x6e", "\x75\162\156\x3a\157\x61\163\x69\x73\x3a\156\x61\155\145\x73\72\x74\143\x3a\x53\x41\x4d\114\72\62\x2e\60\x3a\x61\163\x73\145\x72\x74\x69\x6f\156");
$Yy->registerNamespace("\x73\141\155\x6c\137\155\x65\x74\141\x64\141\164\x61", "\165\162\156\72\157\x61\x73\x69\x73\72\156\x61\x6d\x65\163\72\x74\x63\x3a\123\x41\x4d\114\72\x32\x2e\60\72\155\x65\x74\x61\x64\141\x74\x61");
$Yy->registerNamespace("\x64\x73", "\x68\x74\164\x70\72\57\57\167\x77\167\x2e\x77\63\x2e\x6f\162\147\57\x32\x30\60\x30\57\x30\71\57\170\x6d\154\x64\x73\151\147\43");
$Yy->registerNamespace("\170\x65\156\143", "\x68\x74\164\160\x3a\57\57\x77\167\x77\x2e\x77\x33\x2e\157\x72\147\57\62\x30\x30\x31\57\60\64\57\x78\x6d\154\x65\x6e\x63\x23");
CrR:
$Gu = $Yy->query($HQ, $EB);
$dP = array();
$fN = 0;
SQO:
if (!($fN < $Gu->length)) {
goto AUg;
}
$dP[$fN] = $Gu->item($fN);
c0i:
$fN++;
goto SQO;
AUg:
return $dP;
}
public static function parseNameId(DOMElement $Yu)
{
$dP = array("\x56\141\154\165\145" => trim($Yu->textContent));
foreach (array("\116\x61\x6d\x65\x51\x75\x61\154\x69\146\151\145\162", "\123\x50\x4e\x61\155\145\x51\165\141\x6c\x69\x66\151\145\x72", "\106\x6f\162\x6d\141\x74") as $f7) {
if (!$Yu->hasAttribute($f7)) {
goto KIe;
}
$dP[$f7] = $Yu->getAttribute($f7);
KIe:
Lw3:
}
fjU:
return $dP;
}
public static function xsDateTimeToTimestamp($HX)
{
$oi = array();
$wY = "\57\x5e\50\134\144\134\x64\134\144\134\x64\51\x2d\50\134\144\x5c\x64\51\55\50\134\144\134\144\51\124\50\134\x64\134\x64\x29\x3a\x28\x5c\144\134\x64\51\x3a\x28\134\144\x5c\x64\x29\50\77\x3a\134\56\x5c\144\53\x29\x3f\x5a\x24\57\x44";
if (!(preg_match($wY, $HX, $oi) == 0)) {
goto O8a;
}
echo sprintf("\156\x76\141\154\x69\x64\x20\x53\x41\115\x4c\62\x20\164\x69\x6d\x65\x73\x74\141\x6d\x70\40\160\141\x73\x73\x65\x64\40\x74\157\40\170\x73\104\141\164\145\124\151\x6d\145\x54\157\x54\151\155\145\163\164\x61\155\160\72\40" . $HX);
exit;
O8a:
$sT = intval($oi[1]);
$U2 = intval($oi[2]);
$tj = intval($oi[3]);
$dV = intval($oi[4]);
$Fq = intval($oi[5]);
$if = intval($oi[6]);
$dS = gmmktime($dV, $Fq, $if, $U2, $tj, $sT);
return $dS;
}
public static function extractStrings(DOMElement $Gs, $PP, $gm)
{
$dP = array();
$EB = $Gs->firstChild;
I_H:
if (!($EB !== NULL)) {
goto mSS;
}
if (!($EB->namespaceURI !== $PP || $EB->localName !== $gm)) {
goto rPS;
}
goto u5T;
rPS:
$dP[] = trim($EB->textContent);
u5T:
$EB = $EB->nextSibling;
goto I_H;
mSS:
return $dP;
}
public static function validateElement(DOMElement $zH)
{
$lI = new XMLSecurityDSig();
$lI->idKeys[] = "\111\x44";
$We = self::xpQuery($zH, "\x2e\x2f\x64\x73\72\x53\151\x67\x6e\x61\x74\165\x72\x65");
if (count($We) === 0) {
goto Cgp;
}
if (count($We) > 1) {
goto m2x;
}
goto Tdh;
Cgp:
return FALSE;
goto Tdh;
m2x:
echo sprintf("\130\x4d\x4c\x53\x65\x63\x3a\40\x6d\157\x72\145\40\164\x68\141\156\40\157\x6e\145\x20\163\x69\147\156\141\x74\x75\x72\145\x20\145\154\x65\155\x65\x6e\164\40\x69\x6e\40\162\157\x6f\x74\56");
exit;
Tdh:
$We = $We[0];
$lI->sigNode = $We;
$lI->canonicalizeSignedInfo();
if ($lI->validateReference()) {
goto gpJ;
}
echo sprintf("\x58\115\x4c\163\x65\143\72\x20\144\x69\147\x65\x73\164\40\166\x61\x6c\151\144\141\164\151\157\156\x20\x66\141\x69\154\145\x64");
exit;
gpJ:
$Zn = FALSE;
foreach ($lI->getValidatedNodes() as $fc) {
if ($fc->isSameNode($zH)) {
goto xH3;
}
if ($zH->parentNode instanceof DOMDocument && $fc->isSameNode($zH->ownerDocument)) {
goto lct;
}
goto S4l;
xH3:
$Zn = TRUE;
goto QKL;
goto S4l;
lct:
$Zn = TRUE;
goto QKL;
S4l:
R7Z:
}
QKL:
if ($Zn) {
goto Ksf;
}
echo sprintf("\x58\115\x4c\123\x65\143\x3a\40\124\x68\x65\x20\x72\157\x6f\164\x20\145\154\145\x6d\x65\156\164\40\151\163\40\156\x6f\x74\x20\x73\151\x67\156\x65\x64\x2e");
exit;
Ksf:
$kh = array();
foreach (self::xpQuery($We, "\x2e\x2f\x64\x73\x3a\113\145\171\x49\156\x66\157\x2f\144\163\72\x58\x35\x30\x39\x44\141\x74\x61\x2f\144\163\x3a\130\65\60\x39\x43\x65\x72\164\151\x66\151\x63\141\x74\x65") as $cN) {
$kC = trim($cN->textContent);
$kC = str_replace(array("\15", "\12", "\11", "\40"), '', $kC);
$kh[] = $kC;
cyb:
}
JUi:
$dP = array("\123\x69\x67\156\141\x74\165\162\145" => $lI, "\x43\145\x72\x74\151\x66\x69\x63\x61\x74\145\163" => $kh);
return $dP;
}
public static function validateSignature(array $qT, XMLSecurityKey $tK)
{
$lI = $qT["\123\x69\x67\156\x61\164\165\162\x65"];
$er = self::xpQuery($lI->sigNode, "\56\57\x64\163\72\123\x69\x67\156\145\144\111\156\x66\x6f\x2f\x64\163\x3a\x53\x69\x67\156\x61\164\x75\x72\145\x4d\x65\x74\150\x6f\x64");
if (!empty($er)) {
goto Dg3;
}
echo sprintf("\115\151\163\163\x69\156\147\x20\x53\151\147\156\141\x74\165\x72\x65\x4d\x65\164\x68\157\144\x20\145\154\145\155\145\x6e\164");
exit;
Dg3:
$er = $er[0];
if ($er->hasAttribute("\x41\154\x67\157\162\x69\164\150\x6d")) {
goto XTr;
}
echo sprintf("\115\x69\x73\x73\151\156\x67\x20\x41\154\x67\157\162\151\164\150\x6d\x2d\141\164\x74\162\151\142\x75\x74\145\40\157\x6e\40\123\151\147\x6e\x61\164\x75\x72\x65\115\145\x74\x68\x6f\144\x20\145\154\145\155\x65\156\164\56");
exit;
XTr:
$uP = $er->getAttribute("\x41\x6c\x67\x6f\162\151\164\150\x6d");
if (!($tK->type === XMLSecurityKey::RSA_SHA1 && $uP !== $tK->type)) {
goto GtP;
}
$tK = self::castKey($tK, $uP);
GtP:
if ($lI->verify($tK)) {
goto W99;
}
return false;
W99:
}
public static function castKey(XMLSecurityKey $tK, $rv, $Ks = "\160\x75\x62\154\151\x63")
{
if (!($tK->type === $rv)) {
goto M8K;
}
return $tK;
M8K:
$Jh = openssl_pkey_get_details($tK->key);
if (!($Jh === FALSE)) {
goto XL9;
}
echo sprintf("\x55\x6e\141\x62\x6c\x65\40\x74\x6f\40\147\145\x74\40\153\145\171\40\x64\145\x74\x61\x69\154\x73\40\x66\162\157\x6d\x20\x58\115\114\123\145\x63\x75\162\151\x74\171\113\145\x79\x2e");
exit;
XL9:
if (!empty($Jh["\153\x65\171"])) {
goto rZ8;
}
echo sprintf("\x4d\x69\163\163\x69\x6e\x67\x20\153\145\x79\40\x69\156\x20\160\x75\142\154\151\143\x20\x6b\x65\x79\x20\144\x65\x74\141\x69\x6c\x73\x2e");
exit;
rZ8:
$hA = new XMLSecurityKey($rv, array("\x74\x79\160\145" => $Ks));
$hA->loadKey($Jh["\x6b\145\x79"]);
return $hA;
}
public static function processResponse($V2, $q6, $Nl, SAML2_Response $ZT, $SH, $Na)
{
$Gr = current($ZT->getAssertions());
$A9 = $Gr->getNotBefore();
if (!($A9 !== NULL && $A9 > time() + 60)) {
goto Bbe;
}
wp_die("\x52\145\143\145\x69\x76\x65\144\x20\141\x6e\x20\141\x73\163\145\x72\x74\x69\157\x6e\40\x74\150\141\x74\x20\151\163\x20\x76\141\x6c\x69\144\x20\x69\x6e\40\164\150\145\x20\x66\x75\164\x75\162\145\x2e\x20\103\150\145\143\x6b\x20\143\x6c\157\143\x6b\x20\163\x79\x6e\x63\x68\x72\x6f\x6e\x69\x7a\141\x74\151\157\x6e\x20\x6f\x6e\40\x49\144\x50\40\x61\156\x64\40\x53\x50\x2e");
Bbe:
$F3 = $Gr->getNotOnOrAfter();
if (!($F3 !== NULL && $F3 <= time() - 60)) {
goto ere;
}
wp_die("\x52\x65\x63\x65\151\166\145\x64\x20\141\x6e\x20\141\163\163\x65\162\x74\x69\x6f\x6e\x20\x74\x68\x61\164\40\150\141\163\40\145\170\160\151\162\145\x64\x2e\40\x43\x68\145\x63\x6b\x20\143\154\x6f\x63\x6b\x20\163\171\156\x63\x68\x72\157\x6e\x69\x7a\x61\164\151\157\x6e\x20\x6f\x6e\x20\x49\144\x50\40\x61\156\x64\x20\x53\x50\x2e");
ere:
$mt = $Gr->getSessionNotOnOrAfter();
if (!($mt !== NULL && $mt <= time() - 60)) {
goto B_T;
}
wp_die("\x52\x65\x63\x65\151\166\x65\x64\x20\141\156\40\x61\163\x73\x65\x72\x74\151\x6f\x6e\x20\167\151\x74\x68\x20\x61\x20\x73\145\163\x73\x69\x6f\156\40\164\x68\141\x74\40\x68\x61\163\40\145\170\160\151\162\145\x64\x2e\x20\x43\x68\x65\143\153\40\143\154\157\x63\153\x20\163\171\x6e\143\x68\162\x6f\x6e\151\x7a\x61\164\151\157\x6e\x20\157\x6e\x20\x49\x64\120\x20\x61\x6e\144\40\123\120\x2e");
B_T:
$qX = $ZT->getDestination();
if (!(substr($qX, -1) == "\x2f")) {
goto x2z;
}
$qX = substr($qX, 0, -1);
x2z:
if (!(substr($V2, -1) == "\57")) {
goto B0Z;
}
$V2 = substr($V2, 0, -1);
B0Z:
if (!($qX !== NULL && $qX !== $V2)) {
goto RqS;
}
echo "\104\x65\x73\x74\151\156\x61\164\151\x6f\156\40\151\156\x20\x72\145\163\x70\x6f\x6e\163\x65\40\144\157\x65\x73\x6e\x27\x74\x20\155\x61\x74\143\x68\40\164\150\145\40\x63\x75\x72\162\145\x6e\x74\x20\125\x52\x4c\56\40\104\145\163\164\x69\x6e\141\x74\x69\x6f\156\x20\x69\163\x20\x22" . htmlspecialchars($qX) . "\x22\x2c\x20\143\x75\x72\x72\145\x6e\x74\x20\x55\x52\x4c\40\151\163\40\x22" . htmlspecialchars($V2) . "\42\x2e";
exit;
RqS:
$Fw = self::checkSign($q6, $Nl, $SH, $Na);
return $Fw;
}
public static function checkSign($q6, $Nl, $SH, $Na)
{
$kh = $Nl["\103\145\x72\164\151\146\x69\x63\141\164\145\x73"];
if (count($kh) === 0) {
goto Q3x;
}
$kn = array();
$kn[] = $q6;
$es = self::findCertificate($kn, $kh, $Na);
if ($es) {
goto viI;
}
return FALSE;
viI:
goto S9z;
Q3x:
$zd = maybe_unserialize(get_site_option("\x73\x61\155\x6c\x5f\170\x35\60\71\137\x63\145\x72\164\151\146\x69\143\141\164\145"));
$es = $zd[$SH];
S9z:
$Gp = NULL;
$tK = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array("\164\x79\x70\x65" => "\x70\x75\x62\154\x69\143"));
$tK->loadKey($es);
try {
self::validateSignature($Nl, $tK);
return TRUE;
} catch (Exception $J_) {
$Gp = $J_;
return FALSE;
}
if ($Gp !== NULL) {
goto HPn;
}
return FALSE;
goto Onn;
HPn:
throw $Gp;
Onn:
}
public static function validateIssuerAndAudience($k4, $Mp, $H0, $Na)
{
$V4 = current($k4->getAssertions())->getIssuer();
$Gr = current($k4->getAssertions());
$T7 = $Gr->getValidAudiences();
if (strcmp($H0, $V4) === 0) {
goto u8b;
}
if ($Na == "\164\145\163\164\126\x61\154\151\x64\x61\164\x65" or $Na == "\164\145\163\x74\116\145\x77\103\145\x72\164\x69\x66\151\x63\141\164\x65") {
goto eNB;
}
wp_die("\127\x65\40\x63\157\x75\154\144\40\x6e\157\x74\x20\163\151\147\x6e\40\171\157\165\x20\151\x6e\x2e\x20\120\154\x65\141\163\x65\x20\143\157\156\x74\141\x63\x74\x20\x79\x6f\165\162\x20\x41\144\x6d\x69\x6e\151\x73\x74\x72\141\x74\157\162", "\x45\162\x72\157\162\x20\72\111\x73\x73\165\x65\162\x20\x63\141\x6e\x6e\157\x74\40\x62\145\x20\166\x65\162\x69\146\151\x65\144");
goto C5X;
eNB:
ob_end_clean();
$I7 = mo_options_error_constants::Error_issuer_not_verfied;
$xa = mo_options_error_constants::Cause_issuer_not_verfied;
echo "\x3c\144\151\x76\40\x73\164\171\x6c\x65\x3d\42\146\157\156\x74\55\x66\141\155\151\x6c\x79\72\x43\x61\154\151\x62\x72\151\73\x70\141\144\x64\x69\156\147\72\x30\40\63\x25\x3b\42\x3e";
echo "\74\x64\151\x76\40\x73\x74\171\154\145\x3d\42\x63\x6f\154\x6f\x72\72\x20\43\141\x39\64\x34\x34\62\x3b\142\141\143\x6b\147\x72\x6f\x75\x6e\144\55\x63\157\x6c\x6f\162\72\40\43\146\x32\x64\x65\x64\x65\73\x70\x61\144\x64\151\x6e\147\x3a\40\x31\x35\160\x78\73\x6d\141\x72\x67\x69\156\55\x62\x6f\164\x74\x6f\x6d\x3a\x20\x32\60\x70\x78\73\164\145\170\x74\55\141\154\x69\147\156\72\143\x65\156\x74\145\162\73\x62\157\x72\x64\x65\x72\x3a\x31\x70\170\40\163\157\154\x69\144\x20\43\x45\66\102\63\x42\62\73\x66\x6f\x6e\x74\x2d\x73\x69\172\145\x3a\x31\x38\x70\164\73\42\76\40\105\122\122\117\x52\74\57\144\x69\166\76\15\12\x9\x9\11\40\x3c\x64\151\166\40\x73\x74\171\154\145\75\42\x63\157\154\157\162\72\x20\43\x61\71\64\x34\x34\x32\x3b\x66\x6f\156\164\x2d\163\x69\172\x65\72\61\64\x70\x74\73\x20\155\x61\162\x67\151\156\x2d\142\157\164\x74\157\x6d\72\62\60\x70\170\73\x22\76\74\160\x3e\x3c\163\x74\x72\x6f\x6e\147\76\x45\x72\x72\157\x72\x3a\x20\74\57\163\x74\x72\x6f\x6e\147\x3e\111\163\x73\165\145\x72\x20\143\x61\x6e\x6e\157\x74\x20\x62\x65\x20\x76\145\x72\151\x66\151\x65\x64\56\x3c\57\160\76\xd\xa\11\x9\x9\x20\74\160\76\x50\154\x65\141\x73\145\x20\143\x6f\156\164\141\x63\164\x20\171\x6f\x75\162\x20\x61\144\x6d\151\x6e\x69\x73\x74\x72\x61\164\157\x72\40\141\x6e\144\40\x72\145\x70\x6f\162\164\40\164\x68\145\40\146\x6f\x6c\x6c\x6f\x77\x69\156\147\x20\145\162\162\x6f\x72\72\74\x2f\x70\76\xd\xa\11\x9\x9\x20\74\x70\x3e\x3c\x73\164\162\x6f\156\147\x3e\120\157\x73\x73\x69\142\154\x65\40\x43\141\x75\x73\x65\72\x20\74\57\x73\x74\162\157\156\147\x3e\111\144\120\x20\x45\156\164\x69\164\x79\x20\111\x44\x20\143\x6f\156\x66\151\x67\165\162\x65\144\40\x69\x6e\40\164\150\145\x20\x70\x6c\165\147\151\156\40\x69\x73\40\151\156\x63\157\162\x72\x65\x63\x74\74\x2f\x70\x3e\xd\12\11\11\x9\x20\x3c\160\x3e\74\163\x74\x72\x6f\x6e\147\x3e\x45\156\x74\151\164\x79\40\x49\104\40\x69\156\x20\123\x41\x4d\x4c\40\x52\x65\163\x70\157\156\163\145\72\x20\x3c\57\163\164\162\157\x6e\x67\x3e" . esc_html($V4) . "\74\160\x3e\xd\12\x9\11\x9\40\74\x70\x3e\74\163\x74\162\x6f\156\147\76\105\x6e\x74\151\164\x79\x20\x49\x44\40\143\157\x6e\146\x69\147\165\162\145\x64\40\x69\x6e\40\164\150\145\x20\x70\x6c\x75\x67\x69\x6e\x3a\x20\74\57\163\164\x72\x6f\156\x67\76" . esc_html($H0) . "\74\57\x70\76\15\xa\11\x9\x9\40\x3c\x70\76\x3c\x73\164\x72\157\156\x67\76\123\157\x6c\165\x74\x69\x6f\x6e\x3a\x3c\57\x73\x74\x72\157\156\x67\76\74\x2f\160\76\xd\xa\11\x9\x9\x9\74\157\x6c\76\15\xa\11\x9\11\11\x9\x3c\154\x69\76\103\157\160\171\40\x74\x68\x65\40\105\x6e\164\x69\164\x79\40\111\x44\x20\157\x66\x20\x53\101\x4d\x4c\40\122\145\x73\160\x6f\x6e\x73\145\40\146\162\x6f\155\40\x61\142\157\x76\145\40\141\x6e\x64\x20\160\141\163\x74\145\x20\151\x74\40\151\156\x20\105\156\x74\x69\164\171\x20\x49\104\x20\x6f\162\40\111\x73\163\x75\x65\162\x20\146\151\145\x6c\144\40\x75\156\144\x65\162\40\123\145\x72\x76\x69\x63\145\40\x50\x72\x6f\166\x69\x64\145\x72\40\123\x65\164\x75\160\40\164\141\x62\56\74\x2f\x6c\x69\x3e\xd\12\11\11\11\x9\x3c\x2f\x6f\x6c\x3e\xd\xa\11\x9\11\x20\74\57\144\151\x76\x3e\15\12\11\11\x9\40\x3c\144\151\166\x20\x73\164\x79\154\145\x3d\42\155\x61\x72\147\151\x6e\72\x33\x25\x3b\x64\151\163\x70\154\x61\x79\72\x62\154\x6f\143\153\73\x74\145\170\x74\55\141\x6c\151\147\156\72\x63\x65\156\164\x65\x72\x3b\42\76\xd\12\x9\11\x9\x20\x3c\144\x69\x76\x20\x73\x74\x79\154\145\75\x22\155\141\162\x67\x69\156\72\63\x25\73\x64\x69\163\160\154\x61\171\72\x62\x6c\x6f\143\153\x3b\164\145\170\164\55\141\x6c\151\x67\156\72\x63\145\x6e\x74\145\162\73\x22\x3e\x3c\151\156\x70\x75\x74\40\163\x74\x79\154\x65\x3d\x22\160\141\144\144\x69\x6e\147\72\61\45\x3b\167\x69\x64\x74\x68\72\x31\60\60\160\170\x3b\142\x61\x63\153\x67\162\157\165\156\x64\x3a\x20\43\x30\60\71\61\x43\104\x20\x6e\x6f\156\145\40\x72\145\x70\x65\x61\x74\x20\x73\143\162\x6f\154\x6c\x20\x30\x25\40\60\45\73\143\x75\x72\163\157\162\72\40\x70\x6f\x69\156\164\145\162\73\x66\157\x6e\164\x2d\163\x69\172\145\72\x31\x35\160\x78\x3b\142\x6f\x72\x64\x65\162\55\x77\151\x64\x74\x68\72\x20\61\x70\x78\73\x62\x6f\x72\x64\145\x72\55\163\164\171\154\x65\x3a\40\163\x6f\x6c\x69\x64\73\142\x6f\162\144\x65\162\55\x72\x61\144\151\165\x73\x3a\x20\63\x70\x78\x3b\167\x68\x69\x74\145\x2d\163\160\141\143\145\x3a\40\x6e\157\167\x72\141\x70\73\x62\157\x78\x2d\x73\x69\172\151\x6e\147\72\40\142\x6f\x72\x64\145\x72\55\142\x6f\170\73\142\157\162\144\x65\162\55\143\157\x6c\157\x72\72\x20\x23\60\x30\67\63\101\x41\73\x62\x6f\170\x2d\x73\150\141\144\x6f\167\x3a\x20\x30\160\170\x20\61\160\170\40\60\160\x78\x20\162\x67\142\141\x28\x31\x32\x30\x2c\40\x32\x30\x30\x2c\x20\x32\63\x30\54\40\x30\x2e\66\x29\40\151\x6e\x73\x65\x74\x3b\x63\x6f\154\157\162\72\40\43\x46\x46\x46\73\x22\x74\x79\160\x65\x3d\x22\x62\165\164\x74\x6f\156\x22\x20\x76\x61\154\165\x65\x3d\x22\x44\157\x6e\x65\x22\40\x6f\156\103\154\151\143\x6b\75\x22\163\145\x6c\x66\x2e\x63\154\x6f\x73\x65\50\x29\x3b\x22\x3e\74\x2f\x64\x69\166\76";
mo_saml_download_logs($I7, $xa);
exit;
C5X:
goto X1d;
u8b:
if (empty($T7)) {
goto H0C;
}
if (self::mo_saml_in_array($Mp, $T7, TRUE)) {
goto mPs;
}
if ($Na == "\164\145\x73\x74\126\x61\x6c\x69\x64\x61\164\x65" or $Na == "\x74\145\163\164\116\145\x77\x43\x65\x72\x74\151\146\x69\x63\x61\164\x65") {
goto DZZ;
}
wp_die("\127\x65\40\x63\157\x75\154\144\40\x6e\x6f\x74\40\163\151\x67\x6e\x20\171\157\165\x20\151\156\x2e\x20\120\154\145\141\x73\x65\40\143\x6f\156\x74\141\x63\164\40\171\157\165\162\40\101\144\x6d\x69\x6e\x69\x73\x74\162\x61\164\x6f\x72", "\x45\162\x72\x6f\162\x20\x3a\111\156\x76\141\x6c\x69\144\x20\101\165\x64\x69\x65\x6e\143\145\40\x55\x52\x49");
goto mTj;
DZZ:
$I7 = mo_options_error_constants::Error_invalid_audience;
$xa = mo_options_error_constants::Cause_invalid_audience;
ob_end_clean();
echo "\74\144\x69\x76\40\163\x74\171\x6c\x65\75\x22\x66\x6f\x6e\x74\x2d\x66\x61\155\x69\154\x79\72\x43\x61\154\151\142\162\151\x3b\x70\x61\144\144\x69\x6e\147\72\60\x20\63\45\73\x22\76";
echo "\x3c\x64\151\x76\40\x73\x74\x79\x6c\145\75\42\143\x6f\x6c\x6f\x72\72\x20\x23\141\71\64\x34\x34\62\73\142\141\x63\153\147\x72\157\x75\156\x64\x2d\x63\x6f\154\157\x72\72\x20\x23\146\x32\144\145\x64\x65\73\x70\x61\x64\144\x69\x6e\x67\72\40\61\x35\160\x78\73\x6d\141\162\147\x69\x6e\x2d\x62\x6f\164\x74\x6f\155\72\40\62\60\x70\x78\73\x74\145\x78\164\x2d\x61\154\x69\147\x6e\72\x63\x65\x6e\x74\x65\162\73\142\x6f\162\x64\145\162\72\61\x70\170\40\x73\157\154\x69\144\x20\43\105\66\102\x33\x42\x32\73\x66\157\x6e\x74\x2d\x73\x69\x7a\145\72\61\x38\160\x74\x3b\x22\x3e\40\105\x52\122\117\122\x3c\x2f\144\151\166\76\xd\12\40\40\x20\40\40\x20\x20\40\x20\40\40\40\40\40\x20\x20\40\40\x20\x20\x3c\x64\151\x76\40\163\x74\x79\x6c\x65\75\42\x63\x6f\x6c\x6f\162\x3a\40\43\141\71\x34\x34\x34\62\x3b\146\157\x6e\x74\x2d\x73\151\172\x65\x3a\61\64\x70\164\73\x20\155\141\162\x67\x69\x6e\55\142\157\x74\x74\157\x6d\x3a\62\60\160\170\x3b\42\76\x3c\160\x3e\x3c\163\164\x72\x6f\156\x67\76\105\162\x72\x6f\162\x3a\40\74\57\163\x74\162\157\156\147\76\x49\156\x76\141\x6c\x69\x64\40\101\x75\144\x69\x65\156\x63\x65\40\125\x52\111\x2e\x3c\x2f\160\x3e\xd\12\x20\x20\x20\x20\40\40\40\x20\40\x20\40\x20\40\40\x20\x20\x20\40\40\40\x3c\160\x3e\x50\154\145\x61\163\145\40\x63\157\x6e\x74\x61\x63\x74\x20\171\x6f\165\x72\40\x61\144\x6d\x69\x6e\x69\x73\x74\x72\x61\164\157\162\40\141\x6e\144\40\x72\145\160\x6f\x72\164\40\x74\x68\x65\x20\x66\157\x6c\x6c\x6f\167\151\156\147\40\x65\162\162\x6f\x72\x3a\74\57\x70\x3e\xd\12\40\x20\40\x20\40\x20\40\x20\x20\40\40\40\40\x20\40\40\x20\40\x20\x20\x3c\x70\76\x3c\163\164\x72\x6f\x6e\147\x3e\x50\x6f\x73\x73\151\x62\154\x65\x20\103\x61\165\x73\145\x3a\x20\74\x2f\163\164\x72\x6f\x6e\147\x3e\124\x68\145\40\166\x61\x6c\165\145\x20\x6f\x66\40\x27\101\165\x64\151\x65\156\x63\x65\x20\x55\122\111\47\x20\x66\151\x65\x6c\x64\x20\157\156\x20\111\x64\x65\x6e\x74\151\x74\x79\x20\120\162\x6f\166\151\x64\x65\x72\x27\x73\40\163\x69\x64\145\x20\x69\x73\40\x69\x6e\x63\x6f\162\162\x65\x63\x74\x3c\57\x70\76\xd\xa\40\x20\40\40\40\40\40\40\x20\40\40\x20\40\x20\40\40\x20\x20\40\x20\x3c\x70\76\x45\x78\x70\x65\143\x74\145\144\x20\x6f\x6e\x65\x20\157\x66\x20\164\x68\145\40\x41\165\x64\x69\145\156\x63\x65\x73\x20\164\157\40\142\x65\72\x20" . $Mp . "\74\x70\76\xd\12\11\x9\11\11\11\x3c\x70\76\74\163\164\162\157\x6e\x67\76\x53\x6f\x6c\165\164\x69\157\156\x3a\x3c\x2f\163\x74\162\157\156\x67\76\74\x2f\x70\x3e\xd\12\11\11\x9\x9\11\x3c\x6f\x6c\76\xd\12\x9\11\x9\x9\x9\x9\74\x6c\151\x3e\103\x6f\160\171\40\164\x68\145\x20\105\x78\x70\145\143\x74\145\144\x20\101\165\144\151\145\x6e\x63\145\40\x55\x52\x49\x20\x66\x72\157\x6d\x20\x61\142\157\166\145\40\x61\x6e\144\40\x70\x61\163\x74\x65\40\x69\x74\x20\x69\x6e\40\x74\150\145\x20\101\x75\144\151\x65\x6e\x63\x65\40\125\x52\x49\40\x66\x69\x65\154\x64\x20\141\164\40\x49\x64\145\x6e\x74\151\x74\x79\x20\120\x72\157\166\x69\x64\145\162\40\163\x69\144\145\56\x3c\57\x6c\151\x3e\xd\12\11\11\11\x9\x9\74\x2f\x6f\154\76\15\xa\11\x9\x9\x9\11\x3c\x2f\144\151\166\x3e\xd\12\x20\40\x20\40\40\x20\40\x20\x20\x20\x20\40\40\x20\40\x20\40\x20\40\40\74\x64\151\166\x20\163\x74\171\x6c\145\x3d\42\x6d\x61\162\147\151\156\x3a\63\x25\73\144\151\x73\x70\x6c\x61\x79\x3a\142\154\x6f\x63\x6b\73\x74\x65\170\164\55\x61\154\151\147\x6e\x3a\x63\145\x6e\x74\145\162\x3b\x22\76\15\xa\x20\x20\x20\40\x20\x20\40\x20\x20\x20\40\40\40\40\40\x20\x20\40\x20\40\x3c\144\151\x76\40\163\x74\x79\x6c\145\x3d\x22\x6d\x61\x72\x67\x69\156\72\63\x25\73\144\x69\163\x70\x6c\x61\171\x3a\x62\x6c\157\x63\153\73\x74\145\170\x74\55\x61\x6c\x69\x67\x6e\x3a\x63\x65\156\x74\x65\162\73\42\x3e\x3c\x69\x6e\x70\x75\164\x20\x73\164\171\x6c\145\75\x22\x70\x61\x64\144\x69\156\x67\72\61\x25\73\167\151\x64\164\150\x3a\x31\60\x30\x70\170\73\x62\141\x63\x6b\147\162\x6f\x75\x6e\x64\x3a\x20\43\x30\x30\x39\x31\x43\x44\40\156\157\x6e\145\40\162\x65\160\x65\x61\x74\x20\163\x63\162\x6f\x6c\x6c\x20\x30\45\40\x30\45\73\x63\165\162\163\157\162\x3a\40\x70\x6f\151\x6e\x74\x65\x72\x3b\x66\157\156\164\x2d\x73\x69\x7a\x65\72\61\x35\160\x78\73\142\x6f\x72\144\145\162\55\x77\151\144\164\x68\x3a\40\61\x70\x78\73\142\x6f\x72\144\x65\162\x2d\163\x74\171\x6c\x65\x3a\x20\x73\157\x6c\151\x64\x3b\x62\x6f\162\x64\x65\162\x2d\162\141\144\151\x75\163\72\x20\x33\160\170\73\x77\x68\151\x74\x65\55\163\x70\141\x63\x65\x3a\40\x6e\157\167\162\141\x70\x3b\x62\157\x78\55\x73\151\172\151\x6e\147\72\x20\142\157\162\x64\145\x72\x2d\142\x6f\x78\x3b\142\x6f\162\x64\145\162\55\143\157\x6c\x6f\x72\x3a\40\x23\x30\60\x37\x33\x41\x41\73\x62\157\x78\x2d\x73\150\141\144\x6f\167\72\x20\x30\160\x78\40\x31\160\170\40\x30\x70\x78\x20\162\147\x62\141\x28\61\62\60\x2c\x20\x32\x30\x30\54\40\62\x33\60\x2c\40\x30\x2e\x36\x29\40\151\156\163\145\164\73\143\x6f\154\157\x72\72\40\43\x46\x46\x46\x3b\x22\164\x79\160\x65\x3d\x22\142\x75\x74\164\x6f\x6e\x22\40\x76\141\154\x75\145\x3d\42\x44\157\156\145\x22\x20\157\156\x43\154\151\143\x6b\x3d\x22\163\145\154\x66\56\143\154\x6f\x73\x65\x28\x29\73\42\76\x3c\x2f\x64\x69\x76\x3e";
exit;
mo_saml_download_logs($I7, $xa);
mTj:
goto oTP;
mPs:
return TRUE;
oTP:
H0C:
X1d:
}
private static function findCertificate(array $Gl, array $kh, $Na)
{
$dF = array();
foreach ($kh as $wh) {
$am = strtolower(sha1(base64_decode($wh)));
if (!self::mo_saml_in_array($am, $Gl, TRUE)) {
goto SEQ;
}
$BZ = "\x2d\55\55\55\55\x42\x45\x47\x49\116\40\103\105\x52\124\111\106\111\103\x41\x54\x45\55\x2d\x2d\55\55\12" . chunk_split($wh, 64) . "\x2d\55\x2d\x2d\x2d\105\x4e\x44\x20\x43\x45\x52\124\111\x46\x49\x43\x41\124\105\55\55\55\55\x2d\xa";
return $BZ;
SEQ:
$dF[] = $am;
Jgc:
}
OEH:
return false;
}
private static function doDecryptElement(DOMElement $TY, XMLSecurityKey $nk, array &$Ac)
{
$to = new XMLSecEnc();
$to->setNode($TY);
$to->type = $TY->getAttribute("\x54\x79\x70\x65");
$cn = $to->locateKey($TY);
if ($cn) {
goto vMX;
}
echo sprintf("\x43\157\x75\x6c\x64\x20\156\157\164\40\x6c\x6f\x63\141\164\x65\x20\153\145\x79\40\x61\x6c\x67\157\x72\x69\164\x68\x6d\x20\x69\x6e\40\x65\156\x63\162\171\160\164\x65\144\40\x64\141\164\141\x2e");
exit;
vMX:
$Dn = $to->locateKeyInfo($cn);
if ($Dn) {
goto SQl;
}
echo sprintf("\x43\157\165\154\x64\x20\156\157\x74\x20\154\x6f\x63\141\164\145\40\74\144\163\x69\147\72\113\x65\171\111\x6e\146\157\76\40\146\157\162\x20\x74\x68\145\40\x65\156\143\162\171\160\x74\x65\x64\x20\153\145\171\56");
exit;
SQl:
$f0 = $nk->getAlgorith();
if ($Dn->isEncrypted) {
goto NwF;
}
$YJ = $cn->getAlgorith();
if (!($f0 !== $YJ)) {
goto QOj;
}
echo sprintf("\101\154\x67\x6f\162\x69\x74\150\155\x20\x6d\x69\163\x6d\141\164\x63\x68\40\x62\x65\164\167\x65\145\156\40\151\156\x70\x75\x74\40\x6b\x65\x79\x20\x61\156\144\40\153\145\x79\x20\x69\156\x20\x6d\x65\163\163\141\147\x65\56\40" . "\113\145\171\x20\167\141\163\72\x20" . var_export($f0, TRUE) . "\x3b\x20\155\x65\163\x73\141\x67\145\x20\167\141\x73\72\40" . var_export($YJ, TRUE));
exit;
QOj:
$cn = $nk;
goto cm0;
NwF:
$CG = $Dn->getAlgorith();
if (!self::mo_saml_in_array($CG, $Ac, TRUE)) {
goto Rnc;
}
echo sprintf("\101\x6c\147\x6f\x72\151\x74\150\155\x20\144\x69\x73\141\x62\x6c\145\x64\72\x20" . var_export($CG, TRUE));
exit;
Rnc:
if (!($CG === XMLSecurityKey::RSA_OAEP_MGF1P && $f0 === XMLSecurityKey::RSA_1_5)) {
goto BGy;
}
$f0 = XMLSecurityKey::RSA_OAEP_MGF1P;
BGy:
if (!($f0 !== $CG)) {
goto bYM;
}
echo sprintf("\x41\154\147\157\162\x69\164\x68\x6d\x20\155\151\163\x6d\x61\164\143\x68\x20\x62\x65\164\167\145\x65\x6e\x20\x69\x6e\x70\x75\164\40\153\145\x79\40\x61\156\144\x20\x6b\x65\x79\40\165\x73\x65\144\40\x74\157\40\145\x6e\143\162\171\x70\x74\x20" . "\40\164\x68\x65\40\163\171\155\x6d\x65\x74\162\x69\143\40\153\145\x79\x20\x66\x6f\x72\40\164\x68\145\x20\x6d\x65\x73\163\x61\147\x65\x2e\x20\x4b\x65\171\x20\x77\x61\x73\72\40" . var_export($f0, TRUE) . "\x3b\40\x6d\145\x73\163\x61\x67\145\x20\x77\x61\x73\72\x20" . var_export($CG, TRUE));
exit;
bYM:
$Nq = $Dn->encryptedCtx;
$Dn->key = $nk->key;
$M3 = $cn->getSymmetricKeySize();
if (!($M3 === NULL)) {
goto hF3;
}
echo sprintf("\x55\x6e\x6b\156\157\167\156\x20\x6b\x65\171\40\163\x69\172\x65\40\146\157\x72\x20\145\x6e\143\162\171\160\x74\x69\x6f\x6e\x20\x61\x6c\147\157\162\x69\x74\150\x6d\72\x20" . var_export($cn->type, TRUE));
exit;
hF3:
try {
$tK = $Nq->decryptKey($Dn);
if (!(strlen($tK) != $M3)) {
goto ska;
}
echo sprintf("\x55\x6e\145\170\x70\x65\143\164\145\144\x20\x6b\x65\171\40\163\151\172\x65\x20\x28" . strlen($tK) * 8 . "\x62\151\164\163\x29\x20\146\157\162\x20\145\156\x63\x72\171\160\164\151\x6f\x6e\x20\141\154\x67\157\162\151\164\150\x6d\72\x20" . var_export($cn->type, TRUE));
exit;
ska:
} catch (Exception $J_) {
$yr = $Nq->getCipherValue();
$oE = openssl_pkey_get_details($Dn->key);
$oE = sha1(serialize($oE), TRUE);
$tK = sha1($yr . $oE, TRUE);
if (strlen($tK) > $M3) {
goto O7q;
}
if (strlen($tK) < $M3) {
goto RxI;
}
goto zRr;
O7q:
$tK = substr($tK, 0, $M3);
goto zRr;
RxI:
$tK = str_pad($tK, $M3);
zRr:
}
$cn->loadkey($tK);
cm0:
$rv = $cn->getAlgorith();
if (!self::mo_saml_in_array($rv, $Ac, TRUE)) {
goto wes;
}
echo sprintf("\x41\154\147\157\162\151\164\150\x6d\40\x64\151\163\141\142\154\145\x64\72\x20" . var_export($rv, TRUE));
exit;
wes:
$Rd = $to->decryptNode($cn, FALSE);
$Yu = "\74\x72\x6f\157\164\x20\170\155\154\x6e\x73\72\163\141\x6d\x6c\x3d\42\x75\162\156\x3a\157\x61\x73\151\163\x3a\x6e\141\155\x65\x73\72\164\x63\x3a\123\101\x4d\x4c\72\x32\56\x30\x3a\x61\163\x73\145\162\x74\x69\x6f\156\42\x20" . "\x78\x6d\x6c\x6e\x73\x3a\170\163\151\75\x22\x68\x74\x74\x70\72\x2f\x2f\x77\167\x77\56\x77\63\x2e\x6f\x72\147\x2f\x32\60\60\x31\x2f\130\x4d\114\123\x63\150\x65\x6d\x61\x2d\151\156\163\164\x61\156\x63\x65\x22\x3e" . $Rd . "\x3c\x2f\x72\157\x6f\164\x3e";
$cR = new DOMDocument();
if (@$cR->loadXML($Yu)) {
goto a6Y;
}
echo sprintf("\106\x61\x69\x6c\x65\x64\40\164\157\40\160\141\x72\163\x65\40\x64\x65\143\162\x79\x70\x74\x65\x64\40\130\x4d\114\56\40\115\x61\171\x62\x65\40\164\150\145\x20\167\x72\157\x6e\147\x20\163\150\x61\x72\145\144\x6b\x65\171\40\x77\x61\163\x20\x75\x73\145\x64\77");
throw new Exception("\106\x61\x69\x6c\145\x64\40\164\x6f\x20\x70\141\162\163\145\x20\144\145\143\162\x79\160\x74\x65\144\40\130\115\114\x2e\x20\115\141\171\142\x65\x20\x74\150\145\x20\167\x72\157\x6e\x67\x20\x73\x68\x61\x72\x65\x64\153\145\171\x20\167\x61\163\x20\x75\163\x65\144\x3f");
a6Y:
$Dx = $cR->firstChild->firstChild;
if (!($Dx === NULL)) {
goto wHg;
}
echo sprintf("\x4d\151\163\163\151\x6e\147\x20\x65\x6e\x63\x72\171\x70\x74\145\x64\x20\x65\154\x65\155\x65\156\164\56");
throw new Exception("\x4d\x69\x73\163\x69\x6e\147\40\145\156\x63\x72\x79\x70\164\x65\144\x20\145\x6c\x65\155\x65\156\164\56");
wHg:
if ($Dx instanceof DOMElement) {
goto KJT;
}
echo sprintf("\104\x65\143\x72\171\x70\164\145\144\x20\145\x6c\x65\x6d\145\x6e\164\40\x77\141\163\x20\156\x6f\x74\x20\x61\143\164\165\141\154\154\171\40\141\40\104\117\x4d\x45\x6c\x65\x6d\145\x6e\164\x2e");
KJT:
return $Dx;
}
public static function decryptElement(DOMElement $TY, XMLSecurityKey $nk, array $Ac = array(), XMLSecurityKey $qd = NULL)
{
try {
return self::doDecryptElement($TY, $nk, $Ac);
} catch (Exception $J_) {
echo sprintf("\106\141\151\154\145\x64\x20\164\157\x20\x64\x65\143\x72\x79\160\x74\x20\130\x4d\x4c\40\x65\x6c\x65\x6d\145\x6e\x74\x2e");
exit;
}
}
public static function get_mapped_groups($N4, $jM)
{
$y9 = array();
if (empty($jM)) {
goto Dlq;
}
$ZD = array();
$fN = 1;
EMU:
if (!($fN < 10)) {
goto HqO;
}
$KD = $N4->get("\147\162\157\165\x70" . $fN . "\137\x6d\141\x70");
$ZD[$fN] = explode("\73", $KD);
$fN++;
goto EMU;
HqO:
Dlq:
foreach ($jM as $Cf) {
if (empty($Cf)) {
goto g9n;
}
$fN = 0;
$ra = false;
m4k:
if (!($fN < 9 && !$ra)) {
goto IRN;
}
if (!(!empty($ZD[$fN]) && in_array($Cf, $ZD[$fN]))) {
goto JBa;
}
$y9[] = $N4->get("\x67\x72\x6f\165\160" . $fN);
$ra = true;
JBa:
$fN++;
goto m4k;
IRN:
g9n:
mow:
}
ARZ:
return array_unique($y9);
}
public static function getEncryptionAlgorithm($I5)
{
switch ($I5) {
case "\x68\164\164\x70\72\57\x2f\167\x77\167\x2e\167\63\56\x6f\x72\147\57\x32\x30\x30\x31\x2f\x30\64\x2f\x78\x6d\x6c\145\156\x63\x23\164\x72\x69\x70\x6c\x65\144\x65\163\x2d\143\142\x63":
return XMLSecurityKey::TRIPLEDES_CBC;
goto KbW;
case "\150\x74\164\x70\x3a\x2f\57\167\x77\x77\x2e\167\x33\x2e\157\x72\147\x2f\62\x30\60\61\57\60\64\x2f\x78\155\154\145\x6e\143\x23\141\x65\163\61\x32\70\55\x63\x62\x63":
return XMLSecurityKey::AES128_CBC;
case "\150\164\x74\x70\72\57\x2f\x77\167\167\56\x77\x33\56\157\162\x67\57\62\x30\x30\61\x2f\60\64\x2f\x78\x6d\154\x65\156\143\43\x61\x65\x73\x31\71\62\x2d\143\x62\143":
return XMLSecurityKey::AES192_CBC;
goto KbW;
case "\x68\x74\x74\160\72\57\57\167\167\x77\x2e\x77\x33\x2e\157\x72\x67\x2f\x32\x30\60\61\57\60\64\x2f\170\155\154\145\156\x63\x23\x61\x65\x73\62\x35\x36\x2d\x63\142\143":
return XMLSecurityKey::AES256_CBC;
goto KbW;
case "\150\164\x74\x70\x3a\57\57\x77\x77\x77\x2e\x77\x33\56\x6f\162\147\57\62\60\x30\61\57\60\x34\57\170\x6d\154\145\156\143\x23\x72\163\x61\x2d\61\x5f\x35":
return XMLSecurityKey::RSA_1_5;
goto KbW;
case "\150\164\164\160\72\x2f\x2f\x77\x77\167\x2e\x77\63\x2e\157\x72\x67\x2f\x32\60\60\61\x2f\60\x34\x2f\x78\155\x6c\x65\156\x63\43\x72\x73\x61\55\x6f\141\145\160\x2d\x6d\147\146\61\160":
return XMLSecurityKey::RSA_OAEP_MGF1P;
goto KbW;
case "\150\x74\x74\x70\x3a\57\x2f\167\x77\x77\x2e\x77\63\56\x6f\x72\147\57\x32\x30\60\60\x2f\60\x39\x2f\170\x6d\x6c\x64\163\151\147\43\x64\163\141\55\163\x68\x61\x31":
return XMLSecurityKey::DSA_SHA1;
goto KbW;
case "\x68\x74\164\x70\72\x2f\x2f\x77\x77\x77\56\x77\63\56\157\162\147\x2f\x32\x30\x30\x30\x2f\x30\71\x2f\x78\x6d\x6c\x64\163\x69\x67\x23\162\x73\141\55\x73\x68\x61\61":
return XMLSecurityKey::RSA_SHA1;
goto KbW;
case "\x68\164\x74\160\72\57\x2f\167\167\x77\56\x77\x33\56\x6f\x72\x67\x2f\x32\x30\60\61\57\60\64\x2f\x78\155\x6c\144\163\151\147\x2d\155\x6f\x72\145\x23\162\x73\x61\55\163\x68\141\62\65\66":
return XMLSecurityKey::RSA_SHA256;
goto KbW;
case "\x68\164\164\160\72\x2f\57\x77\x77\x77\56\167\63\x2e\157\162\147\57\x32\x30\x30\x31\x2f\60\64\57\x78\155\x6c\x64\x73\x69\147\x2d\x6d\157\162\x65\x23\x72\163\x61\x2d\163\150\141\x33\x38\64":
return XMLSecurityKey::RSA_SHA384;
goto KbW;
case "\150\164\x74\160\72\57\x2f\167\x77\x77\56\167\63\x2e\157\x72\x67\57\x32\x30\60\61\57\x30\x34\x2f\170\x6d\x6c\144\x73\x69\x67\x2d\x6d\157\162\x65\x23\x72\163\141\55\x73\150\x61\65\x31\x32":
return XMLSecurityKey::RSA_SHA512;
goto KbW;
default:
echo sprintf("\111\156\x76\141\x6c\151\144\40\x45\156\x63\162\171\160\x74\x69\x6f\156\40\x4d\x65\164\x68\x6f\x64\x3a\x20" . $I5);
exit;
goto KbW;
}
qmM:
KbW:
}
public static function insertSignature(XMLSecurityKey $tK, array $kh, DOMElement $zH, DOMNode $y_ = NULL)
{
$lI = new XMLSecurityDSig();
$lI->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
switch ($tK->type) {
case XMLSecurityKey::RSA_SHA256:
$Ks = XMLSecurityDSig::SHA256;
goto JPd;
case XMLSecurityKey::RSA_SHA384:
$Ks = XMLSecurityDSig::SHA384;
goto JPd;
case XMLSecurityKey::RSA_SHA512:
$Ks = XMLSecurityDSig::SHA512;
goto JPd;
default:
$Ks = XMLSecurityDSig::SHA1;
}
iJP:
JPd:
$lI->addReferenceList(array($zH), $Ks, array("\150\164\164\x70\72\x2f\x2f\x77\x77\167\x2e\x77\63\x2e\157\162\x67\x2f\x32\60\x30\60\57\60\x39\x2f\x78\155\154\144\163\x69\147\43\x65\x6e\x76\x65\x6c\157\160\145\144\x2d\163\151\x67\x6e\x61\x74\x75\x72\145", XMLSecurityDSig::EXC_C14N), array("\151\144\137\x6e\x61\155\x65" => "\111\104", "\x6f\166\145\x72\167\162\151\x74\x65" => FALSE));
$lI->sign($tK);
foreach ($kh as $gS) {
$lI->add509Cert($gS, TRUE);
c0f:
}
CB_:
$lI->insertSignature($zH, $y_);
}
public static function getRemainingDaysOfCurrentCertificate()
{
$gS = get_site_option("\155\157\137\x73\141\155\154\x5f\143\165\162\162\145\156\x74\137\143\145\x72\164");
$sd = openssl_x509_parse($gS);
$Kc = $sd["\x76\141\154\151\144\124\x6f\137\x74\151\155\145\x5f\x74"];
$Bt = $Kc - time();
return round($Bt / (60 * 60 * 24));
}
public static function getExpiryDateOfCurrentCertificate()
{
$gS = get_site_option("\x6d\x6f\x5f\x73\x61\x6d\x6c\137\143\165\x72\162\145\156\164\137\143\x65\162\164");
$sd = openssl_x509_parse($gS);
return $sd["\166\141\x6c\151\144\x54\157\x5f\164\x69\155\145\x5f\x74"];
}
public static function getValidUntilDateFromCert($gS)
{
$sd = openssl_x509_parse($gS);
$Kc = $sd["\x76\141\x6c\x69\144\x54\x6f\137\164\x69\155\145\137\164"];
$kW = date("\x59\55\x6d\55\x64", $Kc);
$pC = $kW . "\x54\62\x33\72\x35\x39\72\65\71\132";
return $pC;
}
public static function signXML($Yu, $b8 = '', $mb = false)
{
$Cv = array("\x74\171\160\x65" => "\x70\x72\x69\x76\141\164\x65");
$tK = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, $Cv);
if ($mb) {
goto Zle;
}
$pH = get_site_option("\155\x6f\137\x73\141\155\154\x5f\x63\x75\162\x72\145\156\x74\x5f\x63\145\x72\164\x5f\160\x72\x69\x76\x61\x74\145\137\x6b\x65\171");
$cy = get_site_option("\x6d\157\137\x73\x61\x6d\x6c\137\x63\165\x72\x72\x65\x6e\164\137\143\x65\x72\164");
goto ePi;
Zle:
$pH = file_get_contents(plugin_dir_path(__FILE__) . "\x72\x65\163\x6f\x75\162\x63\145\x73" . DIRECTORY_SEPARATOR . mo_options_enum_default_sp_certificate::SP_Private_Key);
$cy = file_get_contents(plugin_dir_path(__FILE__) . "\x72\x65\x73\157\165\162\x63\145\163" . DIRECTORY_SEPARATOR . mo_options_enum_default_sp_certificate::SP_Public_Certificate);
ePi:
$tK->loadKey($pH, FALSE);
$Hr = new DOMDocument();
$Hr->loadXML($Yu);
$CL = $Hr->firstChild;
if (!empty($b8)) {
goto LUG;
}
self::insertSignature($tK, array($cy), $CL);
goto k8z;
LUG:
$W1 = $Hr->getElementsByTagName($b8)->item(0);
self::insertSignature($tK, array($cy), $CL, $W1);
k8z:
$rA = $CL->ownerDocument->saveXML($CL);
$RL = base64_encode($rA);
return $RL;
}
public static function postSAMLRequest($tX, $GM, $Na)
{
echo "\x3c\150\164\155\x6c\x3e\x3c\142\x6f\x64\x79\x3e\x50\154\x65\x61\163\145\x20\x77\141\x69\x74\56\x2e\x2e\x3c\x66\157\x72\x6d\x20\141\143\164\x69\157\x6e\75\x22" . $tX . "\42\x20\155\x65\x74\150\x6f\144\75\42\x70\157\163\164\x22\40\151\144\75\x22\x73\x61\155\154\55\162\x65\161\x75\x65\x73\x74\x2d\146\157\162\155\x22\x3e\74\x69\x6e\x70\x75\164\x20\x74\171\160\x65\x3d\42\150\151\144\x64\x65\156\42\x20\156\x61\155\x65\x3d\x22\123\x41\x4d\114\x52\145\x71\x75\145\x73\164\42\x20\x76\x61\154\x75\145\75\x22" . $GM . "\42\40\57\x3e\x3c\151\156\160\x75\x74\x20\164\171\x70\x65\75\42\150\151\x64\144\145\156\42\x20\x6e\x61\x6d\145\x3d\x22\122\145\x6c\x61\x79\123\164\x61\164\x65\x22\x20\x76\x61\154\x75\145\x3d\42" . htmlentities($Na) . "\42\40\57\76\x3c\57\x66\x6f\162\x6d\76\74\x73\143\x72\x69\x70\164\x3e\x64\157\x63\x75\x6d\145\x6e\x74\x2e\147\145\x74\105\154\145\155\145\156\164\102\171\111\x64\50\x27\163\141\155\154\55\x72\145\x71\165\145\163\x74\55\146\x6f\x72\155\x27\x29\x2e\163\x75\142\x6d\151\x74\50\x29\73\x3c\57\163\143\x72\x69\x70\x74\76\74\57\x62\157\144\171\76\74\x2f\x68\164\x6d\154\x3e";
exit;
}
public static function postSAMLResponse($tX, $y8, $Na)
{
echo "\74\150\164\155\x6c\76\74\x62\x6f\144\x79\x3e\x50\x6c\145\141\163\145\x20\x77\x61\151\x74\x2e\x2e\x2e\74\146\157\162\x6d\x20\141\x63\x74\151\157\x6e\x3d\x22" . $tX . "\42\x20\x6d\145\164\x68\157\144\75\x22\x70\x6f\x73\x74\x22\40\151\x64\x3d\42\163\141\x6d\154\x2d\162\x65\163\x70\157\x6e\x73\145\x2d\146\157\162\x6d\x22\76\x3c\x69\x6e\160\x75\x74\x20\164\x79\x70\145\75\x22\x68\x69\144\144\145\x6e\x22\40\x6e\141\155\145\x3d\42\123\101\115\114\x52\x65\163\160\157\156\163\x65\x22\x20\166\x61\154\x75\145\75\42" . $y8 . "\x22\x20\x2f\76\74\151\x6e\160\x75\164\x20\x74\171\x70\x65\x3d\x22\x68\151\144\144\145\156\x22\40\156\x61\x6d\x65\75\x22\122\145\154\141\x79\x53\x74\141\164\x65\x22\x20\166\x61\x6c\165\145\75\42" . htmlentities($Na) . "\x22\x20\x2f\76\74\57\146\157\x72\x6d\76\74\x73\143\162\151\x70\x74\76\144\157\143\x75\x6d\145\x6e\164\56\147\x65\164\x45\x6c\x65\155\x65\x6e\x74\102\x79\111\144\50\x27\163\141\155\154\55\x72\145\x73\160\x6f\x6e\163\x65\x2d\x66\157\162\155\47\x29\56\163\165\142\155\x69\164\50\51\x3b\x3c\57\x73\143\162\151\160\x74\76\74\57\x62\157\x64\x79\x3e\x3c\x2f\x68\164\155\154\76";
exit;
}
public static function sanitize_certificate($gS)
{
$gS = preg_replace("\57\x5b\xd\xa\135\x2b\57", '', $gS);
$gS = str_replace("\55", '', $gS);
$gS = str_replace("\102\105\107\x49\116\x20\103\105\x52\x54\111\106\x49\x43\x41\124\x45", '', $gS);
$gS = str_replace("\x45\x4e\x44\x20\x43\105\x52\x54\x49\x46\x49\103\101\124\105", '', $gS);
$gS = str_replace("\40", '', $gS);
$gS = chunk_split($gS, 64, "\15\12");
$gS = "\x2d\x2d\55\55\55\102\x45\x47\x49\x4e\x20\x43\105\x52\124\111\x46\x49\103\x41\124\x45\55\x2d\x2d\55\x2d\xd\12" . $gS . "\55\55\55\55\x2d\x45\x4e\x44\x20\x43\105\x52\124\x49\x46\x49\103\101\x54\105\55\55\x2d\x2d\55";
return $gS;
}
public static function desanitize_certificate($gS)
{
$gS = preg_replace("\x2f\x5b\xd\12\135\x2b\x2f", '', $gS);
$gS = str_replace("\x2d\55\55\55\x2d\102\105\x47\111\116\40\103\x45\122\x54\x49\106\x49\x43\x41\x54\x45\55\55\55\x2d\55", '', $gS);
$gS = str_replace("\x2d\x2d\x2d\55\55\105\116\x44\x20\103\x45\x52\124\x49\x46\111\x43\x41\x54\x45\55\55\55\x2d\55", '', $gS);
$gS = str_replace("\40", '', $gS);
return $gS;
}
public static function get_sites()
{
$rn = array("\156\x65\x74\167\x6f\162\153\137\151\144" => null, "\160\165\x62\154\x69\x63" => null, "\x61\x72\143\x68\x69\x76\x65\144" => 0, "\x6d\x61\164\x75\162\145" => null, "\163\x70\x61\x6d" => 0, "\x64\x65\x6c\x65\x74\145\144" => 0, "\x6e\165\x6d\142\x65\162" => 0, "\x6f\146\146\163\x65\x74" => 0);
if (function_exists("\147\145\164\137\x73\x69\x74\x65\163") && class_exists("\127\120\137\123\x69\x74\145\137\x51\x75\145\162\171")) {
goto cNx;
}
if (!function_exists("\167\160\x5f\x67\x65\164\137\163\151\x74\x65\163")) {
goto zy3;
}
$oL = wp_get_sites($rn);
zy3:
goto f9A;
cNx:
$oL = get_sites($rn);
f9A:
return $oL;
}
public static function get_active_sites()
{
$na = maybe_unserialize(get_site_option("\155\157\x5f\145\x6e\x61\x62\154\x65\x5f\163\163\x6f\x5f\163\x69\164\x65\x73"));
if (!empty($na)) {
goto j02;
}
$na = array();
$oL = self::get_sites();
foreach ($oL as $Qu) {
array_push($na, $Qu->blog_id);
pRB:
}
y_S:
j02:
$xA = self::get_main_subsite_id();
if (self::mo_saml_in_array($xA, $na)) {
goto hyF;
}
array_push($na, $xA);
hyF:
return $na;
}
public static function get_all_roles()
{
$oL = self::get_sites();
$gZ = array();
foreach ($oL as $Qu) {
$EQ = new WP_Roles($Qu->blog_id);
$JM = $EQ->get_names();
$gZ = array_merge($gZ, $JM);
jSz:
}
GZg:
return $gZ;
}
public static function get_main_subsite_id()
{
$oL = self::get_sites();
$Eq = get_site_option("\155\157\x5f\163\x61\x6d\154\x5f\163\x70\x5f\142\141\x73\145\137\x75\x72\x6c");
if (!empty($Eq)) {
goto qj5;
}
$Eq = get_network_site_url();
qj5:
$F5 = $Eq . "\x2f";
$gL = parse_url($Eq, PHP_URL_SCHEME);
$F5 = str_replace($gL . "\x3a\57\x2f", '', $F5);
$Ui = 1;
foreach ($oL as $Qu) {
$no = $Qu->domain . $Qu->path;
if (!($no == $F5)) {
goto HIK;
}
$Ui = $Qu->blog_id;
HIK:
FET:
}
Mtc:
return $Ui;
}
public static function mo_saml_wp_remote_call($tX, $kY, $rn = array(), $WJ = false)
{
if (!$WJ) {
goto rCz;
}
$ZT = wp_remote_get($tX, $rn);
goto CSM;
rCz:
$ZT = wp_remote_post($tX, $rn);
CSM:
if (!is_wp_error($ZT)) {
goto G2f;
}
$T2 = $kY;
update_option("\155\x6f\x5f\163\x61\x6d\x6c\x5f\155\145\x73\163\141\x67\x65", "\125\x6e\141\142\x6c\x65\x20\x74\157\40\x63\x6f\x6e\156\145\x63\164\40\x74\157\40\164\150\x65\x20\x49\156\x74\145\x72\x6e\x65\x74\56\40\120\154\x65\141\163\x65\x20\164\x72\171\x20\x61\x67\x61\x69\156\x2e");
$T2->mo_saml_show_error_message();
return false;
goto PBl;
G2f:
return $ZT["\x62\x6f\144\171"];
PBl:
}
public static function mo_saml_in_array($tK, $Ed, $Fl = false)
{
if (!(is_array($Ed) and in_array($tK, $Ed, $Fl))) {
goto CD6;
}
return true;
CD6:
return false;
}
}
Function Calls
None |
Stats
MD5 | 50728c9acfdd4ebe6122f7a5673e693f |
Eval Count | 0 |
Decode Time | 75 ms |