-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add an encrypt command plus tests. #80
Add an encrypt command plus tests. #80
Conversation
Signed-off-by: Paul Howard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, implementation looks good!
src/subcommands/encrypt.rs
Outdated
//! Encrypts data using a public key or the public part of a key pair. | ||
//! | ||
//! Will use the algorithm set to the key's policy during creation. Currently only | ||
//! supports asymmetric encryption such as RSA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing - should the first line also mention ", or with a secret key"? Otherwise the first line already implies asymmetric encryption only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure exactly what is confusing you, but I can try to clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's better now!
I was confused by the fact that the 2nd line (pre-change) said that we currently only support asymmetric encryption even though the first line made no mention of symmetric keys being usable for that command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I had to re-read a couple of times, but then I got that it was conflating the semantics of the operation with its current functional status, after which it was clear how I could improve it!
…atus of what is supported. Signed-off-by: Paul Howard <[email protected]>
Makes it possible to use
parsec-tool
for encryption (with a public key or the public part of a key pair). The purpose of this is that it enables a use case where asymmetric encryption workflows can be round-tripped using onlyparsec-tool
without any dependencies on third-party tools. This is useful for demonstration purposes.The code is essentially a mirror-image of the existing
decrypt
command. It produces base64 output by default, which can be entered directly intodecrypt
to recover the original string.Test case added to the CLI script. Note that the existing test_encryption function has been re-named to test_decryption, and I have introduced a new test_encryption function so that all of the nomenclature matches up.
Signed-off-by: Paul Howard [email protected]