1

I'm trying to script up a call to scrypt, a command line encryption program. I can call it like this

cat ./mysuperescrettextfile.txt | scrypt enc -

and the dash makes it read from standard in to get the data to encrypt. But then it prompts twice for the password to encrypt. I'd like to pass in the password and use the "-P" flag. The man page describes the -P flag as:

If -P is given, then scrypt does not print any prompts, and reads a passphrase 
from stdin.

Is it possible to send data to standard in in a way that would let scrypt differentiate between the data to encrypt and the password? Usually man pages list mutually exclusive options, but this doesn't list - and -P as mutually exclusive, which gives me a little hope that I can do this.

1 Answers1

0

You should be able to put the file on the command line where you are now putting the -

cat ./passphrase | scrypt enc mysuperescrettextfile.txt 

From the Man Page:

NAME
     scrypt — encrypt and decrypt files.

SYNOPSIS
     scrypt {enc | dec} [-M maxmem] [-m maxmemfrac] [-t maxtime] infile
            [outfile]

DESCRIPTION
     scrypt enc encrypts infile and writes the result to outfile if specified,
     or the standard output otherwise.  The user will be prompted to enter a
     passphrase (twice) to be used to generate a derived encryption key.
  • Ah. Sorry, bad example on my part. I over simplified. I don't want mysupersecrettextfile.txt to be written to disk in the clear. So I build it up in a shell script. Same goes for the passphrase. – Roman Zabicki Mar 05 '17 at 04:10