Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an
encrypt
subcommand that does the inverse ofdecrypt
.Our use case is that we want to use Medusa to export secrets, but we also are exporting our PKI private keys via
/sys/raw
. To keep things simple, we'd like one tool to be able to handle the encryption and decryption of all these files. There's already a subcommand to handle the decryption that works well, so we need a subcommand to do the encryption. (There's no expectation that Medusa will restore the stuff we exported from/sys/raw
.)Help:
This goes back and forth nicely (FWIW this is a test only key and non sensitive data so no need to redact anything):
Implementation note: The output code added to
cmd/encrypt.go
is copy-pasta from:medusa/cmd/export.go
Lines 71 to 97 in 578643a
I can DRY this if you prefer, but didn't want to go refactoring a bunch of stuff without a specific request to do so.