Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


namespace MiniOrange\IDPSaml\Helper;

class PemConverter
{
    protected $pem;
    protected $values = array();
    public function __construct($As)
    {
        $this->pem = $this->sanitize_pem($As);
    }
    public function unpack_pem()
    {
        $ZD = openssl_pkey_get_private($this->pem);
        if (!(false === $ZD)) {
            goto tB;
        }
        $ZD = openssl_pkey_get_public($this->pem);
        tB:
        $rC = openssl_pkey_get_details($ZD);
        $this->values["kty"] = "RSA";
        $M0 = ["n" => "n", "e" => "e", "d" => "d", "p" => "p", "q" => "q", "dp" => "dmp1", "dq" => "dmq1", "qi" => "iqmp"];
        foreach ($rC["rsa"] as $hO => $TC) {
            if (!in_array($hO, $M0)) {
                goto cA;
            }
            $TC = $this->base64url_encode($TC);
            $this->values[array_search($hO, $M0)] = $TC;
            cA:
            WN:
        }
        u8:
        $this->values["use"] = "sig";
    }
    public function sanitize_pem($As)
    {
        preg_match_all("#(-.*-)#", $As, $SB, PREG_PATTERN_ORDER);
        $N7 = preg_replace("#-.*-|\r|\n| #", '', $As);
        $As = $SB[0][0] . PHP_EOL;
        $As .= chunk_split($N7, 64, PHP_EOL);
        $As .= $SB[0][1] . PHP_EOL;
        return $As;
    }
    private function base64url_encode($Ti)
    {
        return rtrim(strtr(base64_encode($Ti), "+/", "-_"), "=");
    }
    private function base64url_decode($Ti)
    {
        return base64_decode(str_pad(strtr($Ti, "-_", "+/"), strlen($Ti) % 4, "=", STR_PAD_RIGHT));
    }
    public function get_values()
    {
        return $this->values;
    }
}



© 2023 Quttera Ltd. All rights reserved.