asgaard.utils.cryptography
Class Cryptography

java.lang.Object
  |
  +--asgaard.utils.cryptography.Cryptography
Direct Known Subclasses:
IDEA, ROT13

public abstract class Cryptography
extends java.lang.Object

Class Cryptography is the abstract class that contains abstract forms of all cryptography functions (the methods here will just throw no such method exceptions). Individual subclasses will implement different cryptographic algorithms, but application programmers should primarily program against this interface.

Copyright © 1997 David Purdue.


Constructor Summary
Cryptography()
           
 
Method Summary
 byte[] decrypt(byte[] ciphertext)
          Place holder for decryption.
 byte[] decryptFinish()
          Place holder for decryption tidy up.
 byte[] encrypt(byte[] plaintext)
          Place holder for encryption function.
 byte[] encryptFinish()
          Place holder for encryption tidy up.
static Cryptography getCrypto(java.lang.String cryptoName)
          The getCrypto method takes the name of a cryptographic algorithm and generates an object that implements it.
 byte[] getKey()
          Place holder for getting a key.
 void setKey(byte[] key)
          Place holder for setting a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cryptography

public Cryptography()
Method Detail

getCrypto

public static Cryptography getCrypto(java.lang.String cryptoName)
                              throws NoSuchCryptoException
The getCrypto method takes the name of a cryptographic algorithm and generates an object that implements it.
Parameters:
cryptoName - The name of the algorithm to use.
Returns:
An object of a subclass of Cryptography - a cryptosystem.
Throws:
NoSuchCryptoException - if the name specified is not a sublass of Cryptography.

encrypt

public byte[] encrypt(byte[] plaintext)
               throws java.lang.NoSuchMethodException
Place holder for encryption function.
Parameters:
plaintext - The plain text to encrypt as an array of bytes.
Returns:
An array of bytes with the cipher text.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.

encryptFinish

public byte[] encryptFinish()
                     throws java.lang.NoSuchMethodException
Place holder for encryption tidy up.
Returns:
An array of bytes with the cipher text.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.

decrypt

public byte[] decrypt(byte[] ciphertext)
               throws java.lang.NoSuchMethodException
Place holder for decryption.
Parameters:
ciphertext - The cipher text to decrypt, an array of bytes.
Returns:
An array of bytes with the plain text.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.

decryptFinish

public byte[] decryptFinish()
                     throws java.lang.NoSuchMethodException
Place holder for decryption tidy up.
Returns:
An array of bytes with the plain text.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.

setKey

public void setKey(byte[] key)
            throws java.lang.NoSuchMethodException
Place holder for setting a key.
Parameters:
key - an array of bytes containing the key.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.

getKey

public byte[] getKey()
              throws java.lang.NoSuchMethodException
Place holder for getting a key.
Returns:
An array of bytes with the user key.
Throws:
java.lang.NoSuchMethodException - Thrown if a subclass does not implement this function and a client tries to use it anyway.