Scriptability

Scriptability is the feature of any software to interact with other tools in the standard UNIX way. Some of the features which make a software scriptable are:

  1. Output error messages to standard error.
  2. When operation is successful, do not output any message.
  3. Read input from standard input, and write to standard output [This is one feature WizCrypt does not support. The support for this is also not planned, as it is not considered as a critical feature required by WizCrypt.]
  4. Defined program exit status [explained in the next section].

Exit Status Of WizCrypt

The following are the exit status supported by WizCrypt:

1 Error in IO Occurs when the file is not
readable/writable, or the file does not exist.
2 Invalid password Password supplied is either too short or too
long.
3 Password mismatch Wrong password is supplied.
4 Multiple exceptions When more than one exception has happened.
5 Security Exception When you try to run the application with
J2RE1.4, or when you have supplied a small
password.
6 Parse Exception When the command line arguments are not
as expected.
7 Console not available The application expects password from console,
but it is running in headless state (eg.
when the application is started using cron).
8 Destination file exists When the destination file (FILE.ext.wiz during
encryption, FILE.ext during decryption) exists
. When -f option is given, this exit status
will not be generated.
0 Clean Exit When the program exits without any problem
after finishing its operation in the expected
way.
Exit Status

Note: When WizCrypt is doing an operation on a batch of files, and when it gives any one of the statuses from 1-8, it means any one or more of the files in the batch has experienced that specific problem(s).

Example

Consider you are decrypting three files: x.wiz, y.wiz and z.wiz:

$ java -jar wizcrypt-XX-jar-with-dependencies.jar -e -p passwd x.wiz y.wiz z.wiz

If x.wiz's password is not "passwd", and y.wiz does not exist in the directory, and z.wiz gets decrypted, the program exits with code 4.