addArgument('file', InputArgument::REQUIRED, 'Filename of the key.') ->addOption('secret', 's', InputOption::VALUE_OPTIONAL, 'Secret if the key is encrypted.', null); } protected function execute(InputInterface $input, OutputInterface $output): int { $file = $input->getArgument('file'); $password = $input->getOption('secret'); if (! is_string($file)) { throw new InvalidArgumentException('Invalid file'); } if ($password !== null && ! is_string($password)) { throw new InvalidArgumentException('Invalid secret'); } $args = $this->getOptions($input); $jwk = JWKFactory::createFromKeyFile($file, $password, $args); $this->prepareJsonOutput($input, $output, $jwk); return self::SUCCESS; } }