nyarly / simplekey

Compatible shell scripts to make GnuPG more accessible and easier to use.
The Unlicense
93 stars 12 forks source link

Multiple recipients #1

Open nyarly opened 10 years ago

nyarly commented 10 years ago

It would be really nice if this were possible

simplekey seal File.txt Alice Betty Eve

At the moment, I'm not sure how to do that, especially if there are spaces in the names used. sh is a harsh master.

hnk commented 10 years ago

I took the liberty of reading about getopts: http://mywiki.wooledge.org/BashFAQ/035#getopts and https://rsalveti.wordpress.com/2007/04/03/bash-parsing-arguments-with-getopts/

Now I'll be honest: I did not read them thoroughly myself, yet.

But I am interested in your project and will see what I could do to help.

nyarly commented 10 years ago

Please do help out - but note that simplekey is using plain old "sh" - I don't think getops is available.

As much as possible, I'd like to avoid using command line switches - there's several places where I've opted for an acceptable default e.g. always outputting to a predictable filename rather than using stdout or an "--output" argument.

nyarly commented 10 years ago

The problem with this is that the list of arguments needs to be added to the GPG --encrypt command, each with a -r ahead of it. I tried building up a $recipients string, but the quotes went haywire - trying to send to "Alice Liddell" "Betty White" -> gpg -r '"Alice' 'Liddell"' -r '"Betty' 'White"' which isn't what's wanted at all.

Unfortunately, my read of the sh splitting and quote handling rules is that it may be impossible, which is it's own issue.

hnk commented 10 years ago

Thanks on the heads up about sh :+1:

Did some quick tests. This way might work: https://gist.github.com/ocfuu/ada6904fd9ea08ff0fed The names would need to be double quoted. simplekey seal File.txt Alice Betty "Eve Charleston"