cryptix.tools
Class Scar

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--cryptix.tools.Scar
All Implemented Interfaces:
java.lang.Runnable

public class Scar
extends java.lang.Thread

A command line utility to (a) compress, encrypt and asciify files and/or directories (with or without directory recursion), and (b) accomplish the inverse with user-specified option for recreating a source tree directory.

Uses java.zip tools to deflate and inflate data, Cryptix IJCE for the cipher and message digest (used to compute cipher keys from user plain ascii passphrase) algorithms, and a PGP-style Base-64 armour with P. R. Zimmermann 24-bit CRC method (PRZ24 class) for the [de-]asciification.

Hard-wired default values for cipher (Square) and Simple String To Key (S2K) specifier with message digest (RIPEMD-160) algorithms are used. These and other default values can be individually modified for each user by setting the appropriate properties in a scar.properties file placed in the user's home directory.

Current scar properties that the user can alter are:

scar.header
The text that will be enclosed between a pair of ----- to visually indicate the start of an asciified scar. Current default is "BEGIN SCAR ARCHIVE".
scar.comment
A text that will follow the text "Comment: " in a line following scar version information in an asciified scar. Current default is "scar by Cryptix...".
scar.footer
The text that will be enclosed between a pair of ----- to visually indicate the end of an asciified scar. Current default is "END SCAR ARCHIVE."
scar.cipher.algorithm
The name of a symmetric cipher algorithm installed and accessible by the user Java VM. Current default is "Square". Square is a symmetric block cipher algorithm developed by Joan Daemen and Vincent Rijmen .
scar.passphrase
The text to use as the pass-phrase. This pass-phrase will be used as the basis for computing a session key. The algorithms used to generate a session key from the pass-phrase are an implementation of the proposed S2K Simple, Salted, Iterated and Salted-Iterated variations described in the OpenPGP IETF draft document dated November 1997. The current default is "sub rosa."
scar.md.algorithm
The Message Digest algorithm used in the S2K algorithms. "RIPEMD-160" Is the default. RIPEMD-160 is designed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel.
scar.md.salt
A salt value to use in S2K Salted and Iterated-Salted variants. Current value is "Cryptix Development Team".
scar.md.iterations
A positive integer to use in S2K Iterated and Salted-Iterated variants. Current default value is 7. To do: Note: this is an alpha release of scar. The format of encrypted archives may (and probably will) change incompatibly in future releases..

Copyright © 1997, 1998 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.4 $

Author:
Raif S. Naffah

Inner Class Summary
(package private)  class Scar.ScarInputStream
           
(package private)  class Scar.ScarOutputStream
           
 
Field Summary
(package private) static char[] BASE64
           
(package private)  java.lang.String comment
          Comment data.
(package private) static int CONV_OTHER
           
(package private) static int CONV_PAD
           
(package private) static int CONV_WHITE
           
static boolean DEBUG
           
(package private) static int debuglevel
           
(package private) static java.lang.String DEFAULT_CIPHER
           
(package private) static java.lang.String DEFAULT_COMMENT
           
(package private) static java.lang.String DEFAULT_FOOTER
           
(package private) static java.lang.String DEFAULT_HEADER
          Default default values!
(package private) static int DEFAULT_ITERATIONS
           
(package private) static java.lang.String DEFAULT_MD
           
(package private) static java.lang.String DEFAULT_PASS_PHRASE
           
(package private) static java.lang.String DEFAULT_SALT
           
(package private) static java.io.PrintWriter err
           
(package private)  java.lang.String footer
          Footer info following ----- in an asciified scar file.
(package private) static java.lang.String fs
          User runtime jvm host file separator.
(package private)  java.lang.String header
          Header info following ----- in an asciified scar file.
(package private) static boolean IN
           
(package private) static int MAX_LINE_LENGTH
           
(package private) static boolean OUT
           
(package private) static char PADDING
           
(package private)  java.util.PropertyResourceBundle properties
          User ResourceBundle file for his/her scar.properties.
(package private) static java.security.SecureRandom random
          Source of randomness.
(package private) static boolean TRACE
           
(package private) static java.lang.String VERSION
           
 
Fields inherited from class java.lang.Thread
inheritableThreadLocals, MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, threadLocals
 
Constructor Summary
Scar()
           
 
Method Summary
(package private) static void debug(java.lang.String s)
           
(package private)  void initDefaults()
          Set default properties.
static void main(java.lang.String[] args)
           
 void processOptions(java.lang.String[] args)
          Process command line arguments.
 void run()
          main action.
(package private) static void trace(boolean in, java.lang.String s)
           
(package private) static void trace(java.lang.String s)
           
 void unzip(java.util.zip.ZipInputStream zip, java.io.File dest)
          unzip files and/or directories to a destination.
 void zip(java.io.File source, java.util.zip.ZipOutputStream zip, int level)
          Zip files and/or directories to a ZipOutputStream.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

debuglevel

static int debuglevel

err

static final java.io.PrintWriter err

TRACE

static final boolean TRACE

IN

static final boolean IN

OUT

static final boolean OUT

properties

java.util.PropertyResourceBundle properties
User ResourceBundle file for his/her scar.properties. Only user home directory is searched for this properties file.

fs

static java.lang.String fs
User runtime jvm host file separator.

header

java.lang.String header
Header info following ----- in an asciified scar file.

footer

java.lang.String footer
Footer info following ----- in an asciified scar file.

comment

java.lang.String comment
Comment data.

random

static final java.security.SecureRandom random
Source of randomness.

DEFAULT_HEADER

static final java.lang.String DEFAULT_HEADER
Default default values!

DEFAULT_FOOTER

static final java.lang.String DEFAULT_FOOTER

DEFAULT_COMMENT

static final java.lang.String DEFAULT_COMMENT

DEFAULT_CIPHER

static final java.lang.String DEFAULT_CIPHER

DEFAULT_PASS_PHRASE

static final java.lang.String DEFAULT_PASS_PHRASE

DEFAULT_MD

static final java.lang.String DEFAULT_MD

DEFAULT_SALT

static final java.lang.String DEFAULT_SALT

DEFAULT_ITERATIONS

static final int DEFAULT_ITERATIONS

CONV_WHITE

static final int CONV_WHITE

CONV_PAD

static final int CONV_PAD

CONV_OTHER

static final int CONV_OTHER

VERSION

static final java.lang.String VERSION

MAX_LINE_LENGTH

static final int MAX_LINE_LENGTH

BASE64

static final char[] BASE64

PADDING

static final char PADDING
Constructor Detail

Scar

public Scar()
Method Detail

debug

static void debug(java.lang.String s)

trace

static void trace(boolean in,
                  java.lang.String s)

trace

static void trace(java.lang.String s)

main

public static void main(java.lang.String[] args)

initDefaults

void initDefaults()
Set default properties.

processOptions

public void processOptions(java.lang.String[] args)
Process command line arguments.

run

public void run()
main action.
Overrides:
run in class java.lang.Thread

zip

public void zip(java.io.File source,
                java.util.zip.ZipOutputStream zip,
                int level)
         throws java.io.FileNotFoundException,
                java.io.IOException
Zip files and/or directories to a ZipOutputStream.
Parameters:
source - source file or directory.
zip - destination zip output stream.
level - depth level in the recursion tree of this method. Used to distinguish top level directory from sub- directories (whether to apply recursion or not).
Throws:
java.io.IOException - if operation fails

unzip

public void unzip(java.util.zip.ZipInputStream zip,
                  java.io.File dest)
           throws java.io.FileNotFoundException,
                  java.io.IOException
unzip files and/or directories to a destination.
Parameters:
src - source zip stream.
dest - destination File object.
Throws:
java.io.IOException - if operation fails