cryptix.tools
Class MCT

java.lang.Object
  |
  +--cryptix.tools.MCT

public final class MCT
extends java.lang.Object

For a designated symmetric block cipher algorithm, this command generates and exercises Monte Carlo Tests data for both Encryption and Decryption in Electronic Codebook (ECB) and Cipher Block Chaining (CBC) modes.

MCT's output file format is in conformance with the layout described in Section 4 of NIST's document "Description of Known Answer Tests and Monte Carlo Tests for Advanced Encryption Standard (AES) Candidate Algorithm Submissions" dated January 7, 1998.

If the -p argument is not specified, this command assumes that the name of the designated cipher algorithm is also that of its Security Provider. It always tries processing the user's request using Java Reflection API methods on an XXX_Algorithm class, if such a class exists --XXX being the name of the AES candidate algorithm. When such a class exists, it is assumed to include the following static methods:

If an *_Algorithm class was not found, or if found but an exception was thrown during the invocation and/or execution of one of its methods, this command then reverts to using the IJCE API methods for carrying on the user's request.

This duality of functionalities is here for performance reasons since speed is faster with the Reflection API than with the IJCE one --on a Pentium 133MHz, without JIT, using JDK-1.1.5 Reflection API brings more than 10% speed improvement.

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

$Revision: 1.5 $

Author:
Raif S. Naffah

Inner Class Summary
(package private)  class MCT.MCT_Key
           
 
Field Summary
(package private)  java.lang.Class algorithm
           
(package private)  java.lang.reflect.Method blockSize
           
(package private)  boolean cbc
           
(package private)  java.lang.String cdFileName
           
(package private)  java.lang.String ceFileName
           
(package private)  Cipher cipher
           
(package private)  java.lang.String cipherName
           
(package private)  long decBlocks
           
(package private)  java.lang.reflect.Method decrypt
           
(package private)  java.io.File destination
           
(package private)  java.lang.String dirName
           
(package private)  boolean ecb
          Current values of switches as set from the command line arguments.
(package private)  java.lang.String edFileName
           
(package private)  java.lang.String eeFileName
           
(package private)  long encBlocks
           
(package private)  java.lang.reflect.Method encrypt
           
(package private)  long keyCount
           
(package private)  java.lang.String keylengths
           
(package private)  int[] keys
           
(package private)  java.lang.reflect.Method makeKey
           
(package private)  java.lang.String provider
           
(package private) static java.lang.String SUBMITTER
           
(package private)  boolean useReflection
           
(package private) static java.lang.String VERSION
           
 
Constructor Summary
MCT()
           
 
Method Summary
(package private)  void cbcDecForKeyIjce(int keysize, java.io.PrintWriter pw)
           
(package private)  void cbcDecForKeyReflect(int keysize, java.io.PrintWriter pw)
           
(package private)  void cbcDecrypt(java.lang.String decName)
           
(package private)  void cbcEncForKeyIjce(int keysize, java.io.PrintWriter pw)
           
(package private)  void cbcEncForKeyReflect(int keysize, java.io.PrintWriter pw)
           
(package private)  void cbcEncrypt(java.lang.String encName)
           
(package private)  void cbcMCT(java.lang.String encName, java.lang.String decName)
           
(package private)  void ecbForKeyIjce(int keysize, java.io.PrintWriter enc, java.io.PrintWriter dec)
           
(package private)  void ecbForKeyReflect(int keysize, java.io.PrintWriter enc, java.io.PrintWriter dec)
           
(package private)  void ecbMCT(java.lang.String encName, java.lang.String decName)
           
(package private) static void halt(java.lang.String s)
          Print an error message to System.err and halts execution returning -1 to the JVM.
static void main(java.lang.String[] args)
           
(package private) static void notify(java.lang.String s)
          Write a notification message to System.out.
(package private)  void printUsage()
          write help text and quit.
(package private)  void processOptions(java.lang.String[] args)
          Process command line arguments.
(package private)  void run()
          main action.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

static final java.lang.String VERSION

SUBMITTER

static final java.lang.String SUBMITTER

ecb

boolean ecb
Current values of switches as set from the command line arguments.

cbc

boolean cbc

dirName

java.lang.String dirName

keylengths

java.lang.String keylengths

provider

java.lang.String provider

cipherName

java.lang.String cipherName

destination

java.io.File destination

keys

int[] keys

eeFileName

final java.lang.String eeFileName

edFileName

final java.lang.String edFileName

ceFileName

final java.lang.String ceFileName

cdFileName

final java.lang.String cdFileName

encBlocks

long encBlocks

decBlocks

long decBlocks

keyCount

long keyCount

algorithm

java.lang.Class algorithm

blockSize

java.lang.reflect.Method blockSize

makeKey

java.lang.reflect.Method makeKey

encrypt

java.lang.reflect.Method encrypt

decrypt

java.lang.reflect.Method decrypt

cipher

Cipher cipher

useReflection

boolean useReflection
Constructor Detail

MCT

public MCT()
Method Detail

main

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

processOptions

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

halt

static void halt(java.lang.String s)
Print an error message to System.err and halts execution returning -1 to the JVM.
Parameters:
s - a message to output on System.err

notify

static void notify(java.lang.String s)
Write a notification message to System.out.
Parameters:
s - string to output to System.out.

printUsage

void printUsage()
write help text and quit.

run

void run()
main action.

ecbMCT

void ecbMCT(java.lang.String encName,
            java.lang.String decName)
      throws java.security.KeyException

ecbForKeyReflect

void ecbForKeyReflect(int keysize,
                      java.io.PrintWriter enc,
                      java.io.PrintWriter dec)
                throws java.lang.IllegalAccessException,
                       java.lang.reflect.InvocationTargetException

ecbForKeyIjce

void ecbForKeyIjce(int keysize,
                   java.io.PrintWriter enc,
                   java.io.PrintWriter dec)
             throws java.security.KeyException

cbcMCT

void cbcMCT(java.lang.String encName,
            java.lang.String decName)
      throws java.security.KeyException

cbcEncrypt

void cbcEncrypt(java.lang.String encName)
          throws java.security.KeyException

cbcEncForKeyReflect

void cbcEncForKeyReflect(int keysize,
                         java.io.PrintWriter pw)
                   throws java.lang.IllegalAccessException,
                          java.lang.reflect.InvocationTargetException

cbcEncForKeyIjce

void cbcEncForKeyIjce(int keysize,
                      java.io.PrintWriter pw)
                throws java.security.KeyException

cbcDecrypt

void cbcDecrypt(java.lang.String decName)
          throws java.security.KeyException

cbcDecForKeyReflect

void cbcDecForKeyReflect(int keysize,
                         java.io.PrintWriter pw)
                   throws java.lang.IllegalAccessException,
                          java.lang.reflect.InvocationTargetException

cbcDecForKeyIjce

void cbcDecForKeyIjce(int keysize,
                      java.io.PrintWriter pw)
                throws java.security.KeyException