Exemplo n.º 1
0
Arquivo: JWK.php Projeto: sop/jwx
 /**
  * Initialize from an array representing a JSON object.
  *
  * @param array $members
  * @return self
  */
 public static function fromArray(array $members)
 {
     $params = array();
     foreach ($members as $name => $value) {
         $params[] = JWKParameter::fromNameAndValue($name, $value);
     }
     return new static(...$params);
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param string ...$certs Base64 encoded DER certificates
  */
 public function __construct(...$certs)
 {
     foreach ($certs as $cert) {
         if (!Base64::isValid($cert)) {
             throw new \UnexpectedValueException("Certificate must be base64 encoded.");
         }
     }
     parent::__construct(self::PARAM_X509_CERTIFICATE_CHAIN, $certs);
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @param string $n Modulus in base64urlUInt encoding
  */
 public function __construct($n)
 {
     $this->_validateEncoding($n);
     parent::__construct(self::PARAM_MODULUS, $n);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  *
  * @param string $p First prime factor in base64urlUInt encoding
  */
 public function __construct($p)
 {
     $this->_validateEncoding($p);
     parent::__construct(self::PARAM_FIRST_PRIME_FACTOR, $p);
 }
 /**
  * Constructor
  *
  * @param string $thumbprint Base64url encoded SHA-256 hash
  */
 public function __construct($thumbprint)
 {
     $this->_validateEncoding($thumbprint);
     parent::__construct(self::PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT, (string) $thumbprint);
 }
Exemplo n.º 6
0
 /**
  * Constructor
  *
  * @param string ...$ops Key operations
  */
 public function __construct(...$ops)
 {
     parent::__construct(self::PARAM_KEY_OPERATIONS, $ops);
 }
Exemplo n.º 7
0
 /**
  * Constructor
  *
  * @param string $uri
  */
 public function __construct($uri)
 {
     parent::__construct(self::PARAM_X509_URL, (string) $uri);
 }
Exemplo n.º 8
0
 /**
  * Constructor
  *
  * @param string $id Key ID
  */
 public function __construct($id)
 {
     parent::__construct(self::PARAM_KEY_ID, $id);
 }
Exemplo n.º 9
0
 /**
  * Constructor
  *
  * @param array[] ...$primes
  */
 public function __construct(...$primes)
 {
     parent::__construct(self::PARAM_OTHER_PRIMES_INFO, $primes);
 }
Exemplo n.º 10
0
 /**
  * Constructor
  *
  * @param string $dq Second factor CRT exponent in base64urlUInt encoding
  */
 public function __construct($dq)
 {
     $this->_validateEncoding($dq);
     parent::__construct(self::PARAM_SECOND_FACTOR_CRT_EXPONENT, $dq);
 }
Exemplo n.º 11
0
 /**
  * Constructor
  *
  * @param string $key Private key in base64url encoding
  */
 public function __construct($key)
 {
     $this->_validateEncoding($key);
     parent::__construct(self::PARAM_ECC_PRIVATE_KEY, $key);
 }
Exemplo n.º 12
0
 /**
  * Constructor
  *
  * @param string $q Second prime factor in base64urlUInt encoding
  */
 public function __construct($q)
 {
     $this->_validateEncoding($q);
     parent::__construct(self::PARAM_SECOND_PRIME_FACTOR, $q);
 }
Exemplo n.º 13
0
 /**
  * Constructor
  *
  * @param string $d Private exponent in base64urlUInt encoding
  */
 public function __construct($d)
 {
     $this->_validateEncoding($d);
     parent::__construct(self::PARAM_PRIVATE_EXPONENT, $d);
 }
Exemplo n.º 14
0
 /**
  * Constructor
  *
  * @param string $use Intended use of the public key
  */
 public function __construct($use)
 {
     parent::__construct(self::PARAM_PUBLIC_KEY_USE, $use);
 }
Exemplo n.º 15
0
 /**
  * Constructor
  *
  * @param string $algo Algorithm name
  */
 public function __construct($algo)
 {
     parent::__construct(self::PARAM_ALGORITHM, $algo);
 }
Exemplo n.º 16
0
 /**
  * Constructor
  *
  * @param string $type Key type
  */
 public function __construct($type)
 {
     parent::__construct(self::PARAM_KEY_TYPE, $type);
 }
Exemplo n.º 17
0
 /**
  * Constructor
  *
  * @param string $key Base64url encoded key
  */
 public function __construct($key)
 {
     $this->_validateEncoding($key);
     parent::__construct(self::PARAM_KEY_VALUE, $key);
 }
Exemplo n.º 18
0
 /**
  * Constructor
  *
  * @param string $curve Curve name
  */
 public function __construct($curve)
 {
     parent::__construct(self::PARAM_CURVE, $curve);
 }
Exemplo n.º 19
0
 /**
  * Constructor
  *
  * @param string $qi First CRT coefficient in base64urlUInt encoding
  */
 public function __construct($qi)
 {
     $this->_validateEncoding($qi);
     parent::__construct(self::PARAM_FIRST_CRT_COEFFICIENT, $qi);
 }