Skip to content

Cannot generate RSA key with console tools #182

@shadowhand

Description

@shadowhand

Describe the bug
Console tools key:generate:rsa are broken because they expect a string to be an int:

$size = $input->getArgument('size');
$args = $this->getOptions($input);
if (!\is_int($size)) {
throw new InvalidArgumentException('Invalid size');
}

These lines are an impossible situation, as input values in command line are always strings. The correct check might be:

if (!is_int($size) && !ctype_digit($size)) {
    // throw exception
}

To Reproduce

./jose.phar key:generate:rsa 2048

In RsaKeyGeneratorCommand.php line 39:

  Invalid size

key:generate:rsa [-u|--use [USE]] [-a|--alg [ALG]] [--random_id] [--] <size>

Expected behavior

A RSA key is generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions