voxpupuli / hiera-eyaml

A backend for Hiera that provides per-value asymmetric encryption of sensitive data
MIT License
527 stars 132 forks source link

Unable to encrypt string that begins with two or more hyphens (dashes) #333

Closed mzagrabe closed 1 year ago

mzagrabe commented 1 year ago

I'm running:

$ /usr/bin/eyaml --version
Welcome to eyaml 3.3.0 
$ /usr/bin/eyaml encrypt --pkcs7-public-key public_key.pkcs7.pem --output block --string  "--"
Error: option '--string' needs a parameter.
Try --help for help.

In particular I would like to pass an SSH private key as the argument to --string:

$ /usr/bin/eyaml encrypt --pkcs7-public-key public_key.pkcs7.pem --output block --string  "-----BEGIN OPENSSH PRIVATE KEY----- etc etc etc"
Error: option '--string' needs a parameter.
Try --help for help.

I know I can:

$ cat /path/to/file | /usr/bin/eyaml encrypt --stdin --pkcs7-public-key public_key.pkcs7.pem --output block

...but was hoping to pass the contents on the CLI.

kenyon commented 1 year ago

Put an =:

/usr/bin/eyaml encrypt --pkcs7-public-key public_key.pkcs7.pem --output block --string="--"