setHelp('This command converts private keys in a key set into public keys.') ->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object'); } protected function execute(InputInterface $input, OutputInterface $output): int { $jwkset = $this->getKeyset($input); $newJwkset = new JWKSet([]); foreach ($jwkset->all() as $jwk) { $newJwkset = $newJwkset->with($jwk->toPublic()); } $this->prepareJsonOutput($input, $output, $newJwkset); return self::SUCCESS; } private function getKeyset(InputInterface $input): JWKSet { $jwkset = $input->getArgument('jwkset'); if (! is_string($jwkset)) { throw new InvalidArgumentException('Invalid JWKSet'); } $json = JsonConverter::decode($jwkset); if (! is_array($json)) { throw new InvalidArgumentException('Invalid JWKSet'); } return JWKSet::createFromKeyData($json); } }