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

Add an encrypt command plus tests. #80

Merged
merged 2 commits into from
Apr 26, 2022

Conversation

paulhowardarm
Copy link
Contributor

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 only parsec-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 into decrypt 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]

Copy link
Member

@ionut-arm ionut-arm left a 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!

Comment on lines 4 to 7
//! 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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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]>
@paulhowardarm paulhowardarm merged commit 7e40ae9 into parallaxsecond:main Apr 26, 2022
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

Successfully merging this pull request may close these issues.

3 participants