/**
  * Método que obtiene la clave asociada al módulo y exponente entregados
  * @param modulus Módulo de la clave
  * @param exponent Exponente de la clave
  * @return Entrega la clave asociada al módulo y exponente
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
  * @version 2015-09-19
  */
 public static function getFromModulusExponent($modulus, $exponent)
 {
     $rsa = new \phpseclib\Crypt\RSA();
     $modulus = new \phpseclib\Math\BigInteger(base64_decode($modulus), 256);
     $exponent = new \phpseclib\Math\BigInteger(base64_decode($exponent), 256);
     $rsa->loadKey(['n' => $modulus, 'e' => $exponent]);
     $rsa->setPublicKey();
     return $rsa->getPublicKey();
 }
 /**
  * Make the Jason API call to the backend via http
  */
 private function make_jason_http_request($data)
 {
     // use key 'http' even if you send the request to https://...
     $options = array('http' => array('header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data)));
     $context = stream_context_create($options);
     $result = file_get_contents(get_option('api_uri'), false, $context);
     $keyArray = $this->get_key();
     // extract the key
     $modulus = $keyArray['keys'][0]['n'];
     $exponent = $keyArray['keys'][0]['e'];
     $rsa = new phpseclib\Crypt\RSA();
     $modulus = new \phpseclib\Math\BigInteger(Firebase\JWT\JWT::urlsafeB64Decode($modulus), 256);
     $exponent = new \phpseclib\Math\BigInteger(Firebase\JWT\JWT::urlsafeB64Decode($exponent), 256);
     $rsa->load(array('n' => $modulus, 'e' => $exponent));
     $rsa->setPublicKey();
     $pubKey = $rsa->getPublicKey();
     $decodedResult = $this->decode_jwt($result, $pubKey);
     return array($decodedResult, $result);
 }