/** * {@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')); }
/** * @param JWKInterface $key */ protected function checkKey(JWKInterface $key) { if ('RSA' !== $key->getKeyType()) { throw new \InvalidArgumentException('The key is not valid'); } }
/** * @param JWKInterface $key */ protected function checkKey(JWKInterface $key) { if ('oct' !== $key->getKeyType() || null === $key->getValue('k')) { throw new \InvalidArgumentException('The key is not valid'); } }
/** * @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'); } }