keybase / python-triplesec

A Python port of the triplesec library.
BSD 3-Clause "New" or "Revised" License
82 stars 18 forks source link

Introduce command-line flags for hex or binary input/output #3

Closed maxtaco closed 5 years ago

FiloSottile commented 10 years ago

Umh, any preference on how exactly to handle this?

At the moment any parameter can be specified as hex by prepending 0x.

As for binary I'm not sure we should get 8-bit input from the command line arguments, so I guess switch to (key as argv[1], input in stdin)?

maxtaco commented 10 years ago

Maybe input is fine as is, but a --binary/-b flag will force binary output (otherwise it's hex).

FiloSottile commented 10 years ago

Yeah, makes sense. But then to decrypt it has to be hex-encoded and passed on the command line... Not really consistent.

FiloSottile commented 10 years ago

I'm starting to think that making the key and not the message optional on the command line might have been a bad idea.

A stdin/stdout Unix flow migth be more elegant. But then how to pass a key in every day use without leaking it to bash history?

maxtaco commented 10 years ago

Maybe it's fine as is. If you want binary, you can do triplesec .... | xxd -r -p?

This is fine with me, come to think of it.

FiloSottile commented 10 years ago

I'm not totally fond of the 0x prepending thing, too

FiloSottile commented 10 years ago

What about

triplesec [-k key] [-b|--binary] [-h|--hex] {enc|dec}  [data]

Key: first checked for in the command line, then in the ENV var $TRIPLESEC_KEY, the prompted from stdin

maxtaco commented 10 years ago

this is great.

heronhaye commented 5 years ago

Seems done.