net.cjb.teutoburgo.otp4u.application
Class OTP4U

java.lang.Object
  |
  +--net.cjb.teutoburgo.otp4u.application.OTP4U

public class OTP4U
extends java.lang.Object

Title: OTP4U

Description: The main class for the command-line application OTP4U (One Time Pad for you)

Copyright: Copyright (c) Pierre Blanc 2003

Company: Teutoburgo

Version:
0.8
Author:
Pierre Blanc

Field Summary
static java.lang.String badParameter
           
static java.lang.String CFG_FILE
           
(package private)  Cipher cipher
           
static java.lang.String CIPHER
           
static java.lang.String CONFIG
           
static java.lang.String ENTROPY
           
(package private)  Io io
           
static java.lang.String KEY_SMALL
           
static java.lang.String KEY4KEY
           
static java.lang.String KEY4KEY_FILE
           
(package private)  KeyManager keyManager
           
(package private)  MessagesPrinter mp
           
static java.lang.String OTP4U_HOME
           
static java.lang.String PLAIN
           
static java.lang.String PSEUDO_RANDOM
           
static java.lang.String PUBLIC_KEY
           
static java.lang.String PUBLIC_KEY_FILE
           
static java.lang.String RANDOM_KEY
           
static java.lang.String RANDOM_KEY_FILE
           
(package private)  RandomGenerator rg
           
static java.lang.String SEPARATOR
           
(package private)  Xor xor
           
 
Constructor Summary
OTP4U()
          OTP4U constructor comment.
OTP4U(boolean isGUI)
           
 
Method Summary
 void doDecryption(java.lang.String pathName)
          Performs decryption if the files of ciphertext and randomKey are found
Writes the plaintext array in its directory
 void doEncryption(java.lang.String pathName)
          Performs encryption if the files of plaintext and randomKey are found
Writes the ciphertext array ciphertext in its directory
 void generateRandomFile(java.lang.String pathName, java.lang.String fileName, int length)
          Used to generate a PSEUDO-random file in the entropySource directory or in the key4key directory.
 java.lang.String getDefaultFile()
           
 int getDefaultLength()
           
 int getRandomKeySize()
           
 byte[][] initArrays(java.lang.String pathName)
           
static void main(java.lang.String[] args)
           
 void otp4uInit(java.lang.String fileName)
          Used by the contructor and by a GUI method to load the properties in the configuration file
 void writePublicKey()
          Used to write the "public" key
 void writeRandomKey()
          Used to write the random key (composed of K4Kn and K4Mn)
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OTP4U_HOME

public static java.lang.String OTP4U_HOME

SEPARATOR

public static final java.lang.String SEPARATOR

PUBLIC_KEY_FILE

public static final java.lang.String PUBLIC_KEY_FILE

CFG_FILE

public static final java.lang.String CFG_FILE

RANDOM_KEY_FILE

public static final java.lang.String RANDOM_KEY_FILE

CIPHER

public static final java.lang.String CIPHER

KEY_SMALL

public static final java.lang.String KEY_SMALL

PLAIN

public static final java.lang.String PLAIN

RANDOM_KEY

public static final java.lang.String RANDOM_KEY

PUBLIC_KEY

public static final java.lang.String PUBLIC_KEY

ENTROPY

public static final java.lang.String ENTROPY

KEY4KEY

public static final java.lang.String KEY4KEY

KEY4KEY_FILE

public static final java.lang.String KEY4KEY_FILE

PSEUDO_RANDOM

public static final java.lang.String PSEUDO_RANDOM

badParameter

public static final java.lang.String badParameter

CONFIG

public static final java.lang.String CONFIG

keyManager

KeyManager keyManager

xor

Xor xor

io

Io io

cipher

Cipher cipher

mp

MessagesPrinter mp

rg

RandomGenerator rg
Constructor Detail

OTP4U

public OTP4U()
OTP4U constructor comment.

OTP4U

public OTP4U(boolean isGUI)
Method Detail

otp4uInit

public void otp4uInit(java.lang.String fileName)
               throws java.io.FileNotFoundException,
                      java.lang.IllegalArgumentException,
                      java.io.IOException,
                      java.lang.NumberFormatException,
                      java.lang.ClassNotFoundException,
                      java.lang.NoSuchMethodException,
                      java.lang.Exception
Used by the contructor and by a GUI method to load the properties in the configuration file
Parameters:
fileName - the name of the configuration file

generateRandomFile

public void generateRandomFile(java.lang.String pathName,
                               java.lang.String fileName,
                               int length)
Used to generate a PSEUDO-random file in the entropySource directory or in the key4key directory. Use it to test the functionalities of OTP4U.
Parameters:
pathName - the path name of the pseudo-random file
fileName - the file name
length - the file length

doDecryption

public void doDecryption(java.lang.String pathName)
Performs decryption if the files of ciphertext and randomKey are found
Writes the plaintext array in its directory
Parameters:
pathName - The pathName of the ciphertext

doEncryption

public void doEncryption(java.lang.String pathName)
Performs encryption if the files of plaintext and randomKey are found
Writes the ciphertext array ciphertext in its directory
Parameters:
pathName - The pathname of the plaintext

getDefaultFile

public java.lang.String getDefaultFile()

getDefaultLength

public int getDefaultLength()

getRandomKeySize

public int getRandomKeySize()

initArrays

public byte[][] initArrays(java.lang.String pathName)
                    throws java.io.IOException

main

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

writePublicKey

public void writePublicKey()
Used to write the "public" key

writeRandomKey

public void writeRandomKey()
Used to write the random key (composed of K4Kn and K4Mn)