Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getCEK(JWKInterface $key, array $header)
 {
     if ('dir' !== $key->getKeyType()) {
         throw new \InvalidArgumentException('The key is not valid');
     }
     return Base64Url::decode($key->getValue('dir'));
 }
Exemple #2
0
 /**
  * @param JWKInterface $key
  */
 protected function checkKey(JWKInterface $key)
 {
     if ('RSA' !== $key->getKeyType()) {
         throw new \InvalidArgumentException('The key is not valid');
     }
 }
Exemple #3
0
 /**
  * @param JWKInterface $key
  */
 protected function checkKey(JWKInterface $key)
 {
     if ('oct' !== $key->getKeyType() || null === $key->getValue('k')) {
         throw new \InvalidArgumentException('The key is not valid');
     }
 }
Exemple #4
0
 /**
  * @param JWKInterface $key
  * @param bool         $is_private
  */
 private function checkKey(JWKInterface $key, $is_private)
 {
     if ('EC' !== $key->getKeyType()) {
         throw new \RuntimeException("The key type must be 'EC'");
     }
     if (null === $key->getValue('d') && true === $is_private) {
         throw new \RuntimeException('The key must be private');
     }
 }