Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For (asymmetric) signature algorithms, verification requires a public key, not a secret #136

Closed
codedust opened this issue Jul 11, 2021 · 3 comments

Comments

@codedust
Copy link
Contributor

Summary

For RSA-/ECC-based signatures, a public key is required for signature verification. Currently, this public key needs to be specified via the --secret parameter which is not intuitive. For RSA-/ECC-based signatures, this parameter should be renamed to --publicKey (or similar).

Steps to reproduce

$ RS256=`cargo run -- encode --alg 'RS256' -S '@./tests/private_rsa_key.der'`
$ cargo run -- decode --alg 'RS256' --secret '@./tests/public_rsa_key.der' $RS256 # <- public key is given via option named `--secret`
...

Expected behavior

# specify public key via `--publicKey` option (for RSA- and ECC-based algorithms)
$ RS256=`cargo run -- encode --alg 'RS256' -S '@./tests/private_rsa_key.der'`
$ cargo run -- decode --alg 'RS256' --publicKey '@./tests/public_rsa_key.der' $RS256
...

# specify secret via `--secret` option (for HMAC-based algorithms)
$ HS256=`cargo run -- encode --alg 'HS256' --secret '1234567890`
$ cargo run -- decode --alg 'HS256' --secret '1234567890` $HS256
...
@mike-engel
Copy link
Owner

I'm not sure this helps much. As of #130, files can be used in encoding and decoding. I agree that maybe --secret doesn't make sense grammatically all the time, but I'm not sure it's worth it to change the flag. If it did change, I would like to find common ground, like --key or something similar.

@codedust
Copy link
Contributor Author

Would you be open for a pull request renaming the parameter from --secret to --key? Passing a public key to an argument called --secret feels a bit odd.

@mike-engel
Copy link
Owner

Yep! We should keep --secret around for a bit, but mark it as deprecated (I'm not sure if clap provides a deprecation function)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants