Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param array $header An associative array of headers. The value can be any type accepted by json_encode or a JSON serializable object
  * @see http://php.net/manual/en/function.json-encode.php
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  * @see https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#section-4
  * @param string $encryptionEngine
  * }
  */
 public function __construct($header = array(), $encryptionEngine = "OpenSSL")
 {
     if (!in_array($encryptionEngine, $this->supportedEncryptionEngines)) {
         throw new InvalidArgumentException(sprintf("Encryption engine %s is not supported", $encryptionEngine));
     }
     $this->encryptionEngine = $encryptionEngine;
     parent::__construct(array(), $header);
 }
Ejemplo n.º 2
0
Archivo: JWS.php Proyecto: namshi/jose
 /**
  * Constructor.
  *
  * @param array $header An associative array of headers. The value can be any type accepted by json_encode or a JSON serializable object
  *
  * @see http://php.net/manual/en/function.json-encode.php
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  * @see https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#section-4
  *
  * @param string $encryptionEngine
  *                                 }
  */
 public function __construct($header = array(), $encryptionEngine = 'OpenSSL')
 {
     if (!in_array($encryptionEngine, $this->supportedEncryptionEngines)) {
         throw new InvalidArgumentException(sprintf('Encryption engine %s is not supported', $encryptionEngine));
     }
     if ('SecLib' === $encryptionEngine && version_compare(PHP_VERSION, '7.0.0-dev') >= 0) {
         throw new InvalidArgumentException("phpseclib 1.0.0(LTS), even the latest 2.0.0, doesn't support PHP7 yet");
     }
     $this->encryptionEngine = $encryptionEngine;
     parent::__construct(array(), $header);
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param string $algorithm
  * @param string $type
  */
 public function __construct($algorithm, $type = null)
 {
     parent::__construct(array(), array('alg' => $algorithm, 'typ' => $type ?: "JWS"));
 }