Zenroom icon indicating copy to clipboard operation
Zenroom copied to clipboard

Zenroom CLI stdin flexibility

Open adam-burns opened this issue 4 years ago • 5 comments

I propose zenroom executables could have command line switches for stdin input type. Input type could be script (Zencode/Lua), data or key.

It could also be useful for zenroom executables to have CLI options to read in file(s) for each type, with any stdin type appended to files or inline parameter CLI code read.

adam-burns avatar May 02 '20 10:05 adam-burns

Execution script already read from stdin like

echo 'print("hello")' | zenroom
[*] Zenroom v1.0.0+89fad9a - secure crypto language VM
 .  Zenroom is Copyright (C) 2017-2020 by the Dyne.org foundation
 .  For the original source code and documentation go to https://zenroom.org
 .  Zenroom is free software: you can redistribute it and/or modify
 .  it under the terms of the GNU Affero General Public License as
 .  published by the Free Software Foundation, either version 3 of the
 .  License, or (at your option) any later version.
 .  Zenroom is distributed in the hope that it will be useful,
 .  but WITHOUT ANY WARRANTY; without even the implied warranty of
 .  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 .  GNU Affero General Public License for more details.
 .  You should have received a copy of the GNU Affero General Public License
 .  along with this program.  If not, see http://www.gnu.org/licenses/
 .  reading Zencode from stdin
 .  loaded file (15 bytes)
 .  using default configuration
 .  System memory manager in use
 .  ECDH curve is GOLDILOCKS
 .  Memory in use: 281 KB
hello
[*] Zenroom teardown.
 .  Memory used: 282 KB

you mean a way to pipe also data and keys, separately?

puria avatar May 02 '20 12:05 puria

A way to choose which of script, data or keys get read through stdin input via piping, yes.

adam-burns avatar May 02 '20 14:05 adam-burns

Yeah that would be great! Probably tweaking the CLI to just support Process substitution would allow to

zenroom <(command) -k <(command1) -a <(command2)

in the very original ol' spaghetti unix style ;p

Would that suits to your needs?

puria avatar May 02 '20 15:05 puria

Good point. I'm just reviewing the CLI and yes: the key and data flag currently don't support inputs to be seekable files nor detect the error when the files aren't seekable.

I will try to fix this.

jaromil avatar Dec 05 '20 09:12 jaromil

Just for instance, a particular use case envisioned would be the ease of piping private or sensitive key material to zenroom stdin (stdout from smartcard reader, tpm, etc) that is not desired to be stored in a file system.

adam-burns avatar Dec 05 '20 09:12 adam-burns

We can now achieve this easily with dyne/cliroom

puria avatar May 31 '23 14:05 puria