|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--hcrypto.cipher.CipherEngine
The CipherEngine class defines the interface for the Cipher class. All of the methods in this class must be implemented by a provider who wishes to provide an implementation of a particular cipher algorithm.
The Cipher class encapsulates an instance of this class. To create a Cipher instance, an application would use the Cipher.getInstance(String algorithm) factory method, where algorithm provides the name of the cipher algorithm -- e.g., "Caesar", "Playfair", and so on.
For example, here's sample code for instantiating and using a Caesar cipher:
Cipher cipher = Cipher.getInstance("Caesar");
HistoricalKey key = HistoricalKey.getInstance("Caesar", cipher.getProvider());
key.init("55/printable");
cipher.init(key);
String c1encrypt = cipher.encrypt(secret);
The Cipher.getInstance() method searches the provider list for an
implementation of Caesar cipher and will throw a "No such algorithm"
exception if none is found. Details on creating an algorithm-dependent
key for the cipher are described in the documentation of
HistoricalKey class.
See also:
Cipher
HistoricalKey
| Field Summary | |
protected java.lang.String |
alphabetRangeOptions
A string of 0s and 1s that describes the options for possible alphabet ranges. |
| Constructor Summary | |
CipherEngine()
|
|
| Method Summary | |
protected abstract java.lang.String |
engineDecrypt(java.lang.String s)
engineDecrypt() encrypts its String parameter returning the encrypted string. |
protected abstract void |
engineDecryptFile(java.lang.String inFile,
java.lang.String outFile)
engineDecryptFile() decrypts a ciphertext input file into an output file. |
protected abstract java.lang.String |
engineEncrypt(java.lang.String s)
engineEncrypt() encrypts its String parameter returning the encrypted string. |
protected abstract void |
engineEncryptFile(java.lang.String inFile,
java.lang.String outFile)
engineEncryptFile() encrypts a plaintext input file into an output file. |
protected abstract void |
engineInit(HistoricalKey key)
engineInit() initializes the particular encrypting engine based on a key of the appropriate type. |
java.lang.String |
getAlphabetRangeOptions()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String alphabetRangeOptions
| Constructor Detail |
public CipherEngine()
| Method Detail |
protected abstract void engineInit(HistoricalKey key)
throws java.lang.Exception
key, - an instance of a HistoricalKey
protected abstract java.lang.String engineEncrypt(java.lang.String s)
throws java.lang.Exception
s, - a String to be encrypted
protected abstract java.lang.String engineDecrypt(java.lang.String s)
throws java.lang.Exception
s, - a String to be encrypted
protected abstract void engineEncryptFile(java.lang.String inFile,
java.lang.String outFile)
throws java.lang.Exception
inFile, - the name of the input plaintext file.outFile, - the name of the output encrypted file.
protected abstract void engineDecryptFile(java.lang.String inFile,
java.lang.String outFile)
throws java.lang.Exception
inFile, - the name of the input ciphertext file.outFile, - the name of the output plaintext file.public java.lang.String getAlphabetRangeOptions()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||