コード例 #1
0
 /**
  * @param string $alg
  * @param string $use
  * @param string $kid
  * @throws InvalidJWKAlgorithm
  */
 public function __construct($alg = JSONWebSignatureAndEncryptionAlgorithms::RS256, $use = JSONWebKeyPublicKeyUseValues::Signature, $kid = null)
 {
     if (!empty($alg) && !in_array($alg, RSAKeysParameters::$valid_algorithms_values)) {
         throw new InvalidJWKAlgorithm(sprintf('alg %s', $alg));
     }
     parent::__construct($alg, $use, $kid);
 }
コード例 #2
0
 /**
  * @param string $shared_secret
  * @param string $alg
  * @param string $use
  * @throws InvalidJWKAlgorithm
  */
 public function __construct($shared_secret = self::GenerateSecret, $alg = JSONWebSignatureAndEncryptionAlgorithms::HS256, $use = JSONWebKeyPublicKeyUseValues::Signature)
 {
     if (!in_array($alg, OctetSequenceKeysParameters::$valid_algorithms_values)) {
         throw new InvalidJWKAlgorithm(sprintf('alg %s', $alg));
     }
     parent::__construct($alg, $use);
     $this->shared_secret = $shared_secret;
 }