net.cjb.teutoburgo.otp4u.crypt
Class Cipher

java.lang.Object
  |
  +--net.cjb.teutoburgo.otp4u.crypt.Cipher

public class Cipher
extends java.lang.Object

Title: OTP4U Description: Copyright: Copyright (c) 2002 Company: Teutoburgo

Version:
1.0
Author:
Pierre Blanc

Field Summary
static java.lang.String CIPHER
           
(package private)  Io io
           
(package private)  boolean isGui
           
(package private)  MessagesPrinter mp
           
 java.lang.String OTP4U_HOME
           
static java.lang.String PLAIN
           
static java.lang.String RANDOM_KEY
           
static java.lang.String RANDOM_KEY_FILE
           
(package private)  Xor xor
           
 
Constructor Summary
Cipher()
           
Cipher(java.lang.String home, boolean isGui)
           
 
Method Summary
 int decipher(java.lang.String pathName)
          Performs decryption if the files of ciphertext and randomKey are found
Writes the plaintext array in its directory
 void encipher(java.lang.String pathName)
          Performs encryption if the files of plaintext and randomKey are found
Writes the ciphertext array ciphertext in its directory
 byte[] getRealKey(byte[] random, int l)
          Gets from the randomKey file the exact number of bytes needed for a particular encryption/decryption, then removes them from randomKey
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM_KEY_FILE

public static final java.lang.String RANDOM_KEY_FILE

PLAIN

public static final java.lang.String PLAIN

CIPHER

public static final java.lang.String CIPHER

RANDOM_KEY

public static final java.lang.String RANDOM_KEY

OTP4U_HOME

public java.lang.String OTP4U_HOME

xor

Xor xor

io

Io io

isGui

boolean isGui

mp

MessagesPrinter mp
Constructor Detail

Cipher

public Cipher()

Cipher

public Cipher(java.lang.String home,
              boolean isGui)
Method Detail

decipher

public int decipher(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

encipher

public void encipher(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

getRealKey

public byte[] getRealKey(byte[] random,
                         int l)
Gets from the randomKey file the exact number of bytes needed for a particular encryption/decryption, then removes them from randomKey
Parameters:
random - the randomKey array
l - the number of bytes needed