Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\miniorange_saml; class MetadataReader { private $iden..
Decoded Output download
<?php
namespace Drupal\miniorange_saml;
class MetadataReader
{
private $identityProviders;
private $serviceProviders;
public function __construct(\DOMNode $Nh = NULL)
{
$this->identityProviders = array();
$this->serviceProviders = array();
$rk = Utilities::xpQuery($Nh, "./saml_metadata:EntityDescriptor");
foreach ($rk as $QE) {
$w5 = Utilities::xpQuery($QE, "./saml_metadata:IDPSSODescriptor");
if (!(isset($w5) && !empty($w5))) {
goto up;
}
array_push($this->identityProviders, new IdentityProviders($QE));
up:
FB:
}
x_:
}
public function getIdentityProviders()
{
return $this->identityProviders;
}
public function getServiceProviders()
{
return $this->serviceProviders;
}
}
class IdentityProviders
{
private $idpName;
private $entityID;
private $loginDetails;
private $logoutDetails;
private $signingCertificate;
private $encryptionCertificate;
private $signedRequest;
public function __construct(\DOMElement $Nh = NULL)
{
$this->idpName = '';
$this->loginDetails = array();
$this->logoutDetails = array();
$this->signingCertificate = array();
$this->encryptionCertificate = array();
if (!$Nh->hasAttribute("entityID")) {
goto qT;
}
$this->entityID = $Nh->getAttribute("entityID");
qT:
if (!$Nh->hasAttribute("WantAuthnRequestsSigned")) {
goto W5;
}
$this->signedRequest = $Nh->getAttribute("WantAuthnRequestsSigned");
W5:
$w5 = Utilities::xpQuery($Nh, "./saml_metadata:IDPSSODescriptor");
if (count($w5) > 1) {
goto Fx;
}
if (empty($w5)) {
goto rJ;
}
goto tJ;
Fx:
throw new Exception("More than one <IDPSSODescriptor> in <EntityDescriptor>.");
goto tJ;
rJ:
throw new Exception("Missing required <IDPSSODescriptor> in <EntityDescriptor>.");
tJ:
$bi = $w5[0];
$x8 = Utilities::xpQuery($Nh, "./saml_metadata:Extensions");
if (!$x8) {
goto Ow;
}
$this->parseInfo($bi);
Ow:
$this->parseSSOService($bi);
$this->parseSLOService($bi);
$this->parsex509Certificate($bi);
}
private function parseInfo($Nh)
{
$s8 = Utilities::xpQuery($Nh, "./mdui:UIInfo/mdui:DisplayName");
foreach ($s8 as $VF) {
if (!($VF->hasAttribute("xml:lang") && $VF->getAttribute("xml:lang") == "en")) {
goto pH;
}
$this->idpName = $VF->textContent;
pH:
YJ:
}
ot:
}
private function parseSSOService($Nh)
{
$Qj = Utilities::xpQuery($Nh, "./saml_metadata:SingleSignOnService");
foreach ($Qj as $be) {
$Os = str_replace("urn:oasis:names:tc:SAML:2.0:bindings:", '', $be->getAttribute("Binding"));
$this->loginDetails = array_merge($this->loginDetails, array($Os => $be->getAttribute("Location")));
Ds:
}
dz:
}
private function parseSLOService($Nh)
{
$VX = Utilities::xpQuery($Nh, "./saml_metadata:SingleLogoutService");
foreach ($VX as $LE) {
$Os = str_replace("urn:oasis:names:tc:SAML:2.0:bindings:", '', $LE->getAttribute("Binding"));
$this->logoutDetails = array_merge($this->logoutDetails, array($Os => $LE->getAttribute("Location")));
Gq:
}
pZ:
}
private function parsex509Certificate($Nh)
{
foreach (Utilities::xpQuery($Nh, "./saml_metadata:KeyDescriptor") as $kn) {
if ($kn->hasAttribute("use")) {
goto yz;
}
$this->parseSigningCertificate($kn);
goto ed;
yz:
if ($kn->getAttribute("use") == "encryption") {
goto vP;
}
$this->parseSigningCertificate($kn);
goto LC;
vP:
$this->parseEncryptionCertificate($kn);
LC:
ed:
hx:
}
Rh:
}
private function parseSigningCertificate($Nh)
{
$Pw = Utilities::xpQuery($Nh, "./ds:KeyInfo/ds:X509Data/ds:X509Certificate");
$LL = trim($Pw[0]->textContent);
$LL = str_replace(array("\xd", "\xa", " ", " "), '', $LL);
if (empty($Pw)) {
goto bI;
}
array_push($this->signingCertificate, Utilities::sanitize_certificate($LL));
bI:
}
private function parseEncryptionCertificate($Nh)
{
$Pw = Utilities::xpQuery($Nh, "./ds:KeyInfo/ds:X509Data/ds:X509Certificate");
$LL = trim($Pw[0]->textContent);
$LL = str_replace(array("\xd", "\xa", "\x9", " "), '', $LL);
if (empty($Pw)) {
goto Jq;
}
array_push($this->encryptionCertificate, $LL);
Jq:
}
public function getIdpName()
{
return '';
}
public function getEntityID()
{
return $this->entityID;
}
public function getLoginURL($Os)
{
return $this->loginDetails[$Os];
}
public function getLogoutURL($Os)
{
return isset($this->logoutDetails[$Os]) ? $this->logoutDetails[$Os] : '';
}
public function getLoginDetails()
{
return $this->loginDetails;
}
public function getLogoutDetails()
{
return $this->logoutDetails;
}
public function getSigningCertificate()
{
return $this->signingCertificate;
}
public function getEncryptionCertificate()
{
return $this->encryptionCertificate[0];
}
public function isRequestSigned()
{
return $this->signedRequest;
}
}
class ServiceProviders
{
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\miniorange_saml;
class MetadataReader
{
private $identityProviders;
private $serviceProviders;
public function __construct(\DOMNode $Nh = NULL)
{
$this->identityProviders = array();
$this->serviceProviders = array();
$rk = Utilities::xpQuery($Nh, "\56\57\163\x61\155\x6c\137\x6d\145\164\141\x64\141\x74\141\x3a\105\x6e\164\151\164\171\104\x65\163\x63\x72\151\160\164\x6f\x72");
foreach ($rk as $QE) {
$w5 = Utilities::xpQuery($QE, "\56\x2f\163\x61\155\154\x5f\x6d\145\x74\x61\144\141\x74\141\x3a\111\x44\120\123\123\117\104\145\x73\x63\162\151\160\x74\x6f\162");
if (!(isset($w5) && !empty($w5))) {
goto up;
}
array_push($this->identityProviders, new IdentityProviders($QE));
up:
FB:
}
x_:
}
public function getIdentityProviders()
{
return $this->identityProviders;
}
public function getServiceProviders()
{
return $this->serviceProviders;
}
}
class IdentityProviders
{
private $idpName;
private $entityID;
private $loginDetails;
private $logoutDetails;
private $signingCertificate;
private $encryptionCertificate;
private $signedRequest;
public function __construct(\DOMElement $Nh = NULL)
{
$this->idpName = '';
$this->loginDetails = array();
$this->logoutDetails = array();
$this->signingCertificate = array();
$this->encryptionCertificate = array();
if (!$Nh->hasAttribute("\x65\x6e\164\x69\164\x79\111\104")) {
goto qT;
}
$this->entityID = $Nh->getAttribute("\x65\156\x74\151\x74\171\111\104");
qT:
if (!$Nh->hasAttribute("\127\x61\x6e\x74\101\x75\164\150\156\122\145\x71\165\145\163\x74\163\123\x69\x67\x6e\x65\144")) {
goto W5;
}
$this->signedRequest = $Nh->getAttribute("\127\x61\156\x74\x41\165\x74\150\156\122\x65\161\x75\145\163\x74\163\123\151\x67\156\x65\144");
W5:
$w5 = Utilities::xpQuery($Nh, "\56\57\163\141\x6d\154\x5f\x6d\x65\164\x61\x64\x61\164\x61\72\111\x44\x50\123\123\x4f\x44\145\163\x63\162\151\160\164\x6f\x72");
if (count($w5) > 1) {
goto Fx;
}
if (empty($w5)) {
goto rJ;
}
goto tJ;
Fx:
throw new Exception("\115\157\162\145\40\x74\x68\141\x6e\x20\x6f\156\x65\x20\74\x49\x44\x50\123\123\117\104\x65\163\143\162\x69\x70\164\x6f\x72\76\x20\x69\x6e\x20\74\105\x6e\x74\x69\164\x79\x44\x65\x73\x63\x72\151\160\x74\157\162\x3e\56");
goto tJ;
rJ:
throw new Exception("\115\x69\x73\163\x69\156\147\x20\x72\145\x71\x75\x69\x72\145\144\x20\74\111\104\x50\x53\x53\x4f\104\x65\x73\143\162\151\x70\x74\x6f\x72\x3e\x20\151\x6e\x20\x3c\105\x6e\164\151\164\x79\104\x65\163\x63\x72\151\x70\x74\157\162\76\x2e");
tJ:
$bi = $w5[0];
$x8 = Utilities::xpQuery($Nh, "\56\x2f\163\141\x6d\154\137\x6d\145\x74\141\144\x61\164\x61\72\105\x78\x74\x65\x6e\163\x69\157\x6e\x73");
if (!$x8) {
goto Ow;
}
$this->parseInfo($bi);
Ow:
$this->parseSSOService($bi);
$this->parseSLOService($bi);
$this->parsex509Certificate($bi);
}
private function parseInfo($Nh)
{
$s8 = Utilities::xpQuery($Nh, "\x2e\x2f\155\x64\165\151\x3a\x55\x49\x49\156\146\x6f\x2f\155\144\165\x69\x3a\104\x69\163\160\x6c\141\x79\116\x61\x6d\x65");
foreach ($s8 as $VF) {
if (!($VF->hasAttribute("\x78\155\154\x3a\x6c\x61\x6e\x67") && $VF->getAttribute("\170\155\x6c\x3a\x6c\141\156\147") == "\145\x6e")) {
goto pH;
}
$this->idpName = $VF->textContent;
pH:
YJ:
}
ot:
}
private function parseSSOService($Nh)
{
$Qj = Utilities::xpQuery($Nh, "\56\57\x73\141\x6d\154\x5f\x6d\145\x74\x61\144\141\x74\x61\72\x53\151\x6e\147\154\145\x53\x69\147\156\x4f\156\123\x65\162\x76\x69\143\x65");
foreach ($Qj as $be) {
$Os = str_replace("\x75\x72\156\72\157\141\163\151\163\x3a\x6e\141\x6d\x65\163\72\x74\143\72\123\101\x4d\114\72\x32\56\60\72\142\151\x6e\144\151\x6e\x67\163\x3a", '', $be->getAttribute("\102\151\156\x64\151\156\x67"));
$this->loginDetails = array_merge($this->loginDetails, array($Os => $be->getAttribute("\114\157\x63\141\164\151\x6f\x6e")));
Ds:
}
dz:
}
private function parseSLOService($Nh)
{
$VX = Utilities::xpQuery($Nh, "\56\57\163\x61\x6d\154\137\x6d\145\x74\x61\144\x61\164\141\x3a\x53\151\156\147\154\x65\x4c\157\x67\157\165\x74\123\x65\x72\166\x69\143\x65");
foreach ($VX as $LE) {
$Os = str_replace("\x75\162\x6e\x3a\x6f\141\x73\x69\x73\x3a\156\141\155\145\x73\72\x74\x63\72\123\101\115\x4c\x3a\62\x2e\60\x3a\x62\151\x6e\144\x69\156\x67\x73\72", '', $LE->getAttribute("\102\151\156\x64\x69\156\147"));
$this->logoutDetails = array_merge($this->logoutDetails, array($Os => $LE->getAttribute("\114\157\x63\x61\x74\151\x6f\x6e")));
Gq:
}
pZ:
}
private function parsex509Certificate($Nh)
{
foreach (Utilities::xpQuery($Nh, "\56\x2f\163\141\155\154\x5f\x6d\x65\164\141\144\x61\x74\141\x3a\x4b\x65\x79\104\x65\x73\x63\x72\151\x70\164\x6f\x72") as $kn) {
if ($kn->hasAttribute("\165\x73\145")) {
goto yz;
}
$this->parseSigningCertificate($kn);
goto ed;
yz:
if ($kn->getAttribute("\x75\x73\145") == "\x65\x6e\143\x72\x79\160\164\151\157\x6e") {
goto vP;
}
$this->parseSigningCertificate($kn);
goto LC;
vP:
$this->parseEncryptionCertificate($kn);
LC:
ed:
hx:
}
Rh:
}
private function parseSigningCertificate($Nh)
{
$Pw = Utilities::xpQuery($Nh, "\x2e\57\144\163\x3a\x4b\x65\171\x49\156\146\157\57\x64\x73\x3a\x58\65\x30\71\104\x61\x74\x61\x2f\x64\x73\x3a\x58\65\60\71\x43\x65\162\164\x69\146\151\143\x61\164\145");
$LL = trim($Pw[0]->textContent);
$LL = str_replace(array("\xd", "\xa", "\11", "\x20"), '', $LL);
if (empty($Pw)) {
goto bI;
}
array_push($this->signingCertificate, Utilities::sanitize_certificate($LL));
bI:
}
private function parseEncryptionCertificate($Nh)
{
$Pw = Utilities::xpQuery($Nh, "\x2e\x2f\x64\163\72\x4b\145\x79\111\x6e\146\x6f\x2f\144\163\72\130\x35\60\x39\x44\141\164\x61\57\144\163\x3a\130\x35\x30\x39\103\145\x72\164\x69\146\x69\143\141\x74\x65");
$LL = trim($Pw[0]->textContent);
$LL = str_replace(array("\xd", "\xa", "\x9", "\40"), '', $LL);
if (empty($Pw)) {
goto Jq;
}
array_push($this->encryptionCertificate, $LL);
Jq:
}
public function getIdpName()
{
return '';
}
public function getEntityID()
{
return $this->entityID;
}
public function getLoginURL($Os)
{
return $this->loginDetails[$Os];
}
public function getLogoutURL($Os)
{
return isset($this->logoutDetails[$Os]) ? $this->logoutDetails[$Os] : '';
}
public function getLoginDetails()
{
return $this->loginDetails;
}
public function getLogoutDetails()
{
return $this->logoutDetails;
}
public function getSigningCertificate()
{
return $this->signingCertificate;
}
public function getEncryptionCertificate()
{
return $this->encryptionCertificate[0];
}
public function isRequestSigned()
{
return $this->signedRequest;
}
}
class ServiceProviders
{
}
Function Calls
None |
Stats
MD5 | 5e6d1bded78ffb602f7390a87a13f5a1 |
Eval Count | 0 |
Decode Time | 68 ms |