|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.crypt.Cipher
ccs.crypt.AbstractBlockCipher
ccs.crypt.NullCipher
public class NullCipher
A Null Cipher. Its output is identical to its input, except that the "ciphertext" has an Adler32 checksum appended to it. Useful as a placeholder in situations where you might want encryption or you might not - use the same code in each, but make your Cipher a real Cipher for encryption and a NullCipher for no encryption.
Field Summary |
---|
Fields inherited from class ccs.crypt.AbstractBlockCipher |
---|
buffer |
Fields inherited from class ccs.crypt.Cipher |
---|
passwd |
Constructor Summary | |
---|---|
NullCipher()
|
Method Summary | |
---|---|
protected void |
bufferDecrypt(int nblocks)
Decrypt the number of blocks specified from the internal buffer, updating the MAC with the result. |
protected void |
bufferEncrypt(int nblocks)
Encrypt the number of blocks specified from the internal buffer, updating the MAC with the result. |
int |
getBlockSizeExp()
The logarithm to base 2 of the block size of the cipher in bytes. |
protected int |
getHeaderLength()
The size of the header, without any self-delimitation info. |
CipherInputStream |
getInputStream(java.io.InputStream is,
boolean isSelfDelimit)
Returns a CipherInputStream that reads ciphertext from the
underlying stream and provides plaintext. |
protected byte[] |
getMAC()
Obtain the MAC for the stream. |
protected int |
getMACLength()
The size of the MAC. |
CipherOutputStream |
getOutputStream(java.io.OutputStream os,
long plainlen)
Returns a CipherOutputStream that accepts plaintext and writes
ciphertext to the underlying stream. |
byte[] |
getPasswd()
returns the password, which is null. |
protected void |
getWhitening(byte[] buf)
Produce and return 8 bytes (exactly) of "whitening". |
void |
setPasswd(byte[] pw)
Sets the password, which is ignored completely. |
Methods inherited from class ccs.crypt.AbstractBlockCipher |
---|
checkRegistered, getCiphertextLength, getPlaintextLength, getTrailerLength, register, unregister |
Methods inherited from class ccs.crypt.Cipher |
---|
out |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NullCipher()
Method Detail |
---|
public void setPasswd(byte[] pw)
setPasswd
in class Cipher
pw
- The password to be neglected.public byte[] getPasswd()
getPasswd
in class Cipher
public CipherOutputStream getOutputStream(java.io.OutputStream os, long plainlen) throws CipherException, java.io.IOException
CipherOutputStream
that accepts plaintext and writes
ciphertext to the underlying stream.
getOutputStream
in class Cipher
os
- The stream to write ciphertext to.plainlen
- The length of plaintext to be written. If known, this
allows the length to be encrypted as part of the stream itself, and
makes the ciphertext self-delimiting; where many ciphertexts are concatenated
onto a stream, no boundary sequences are required in this mode, which is
preferable. (Such sequences leak information.) In this case, you send exactly
the amount of plaintext you specify, no more, no less. Supply -1 if you really
don't know; in this case, you must delimit the ciphertext yourself.
CipherException
- if a cryptographic problem occurs.
java.io.IOException
- if the CipherOutputStream
could not be
created for some reason.public CipherInputStream getInputStream(java.io.InputStream is, boolean isSelfDelimit) throws CipherException, java.io.IOException
CipherInputStream
that reads ciphertext from the
underlying stream and provides plaintext.
getInputStream
in class Cipher
is
- The stream to read ciphertext from.isSelfDelimit
- Whether the ciphertext is self-delimiting,
ie. it has its own length stored inside itself. If not, the ciphertext
is assumed to extend to EOF.
CipherException
- if a cryptographic problem occurs.
java.io.IOException
- if the CipherInputStream
could not be
created for some reason.protected void getWhitening(byte[] buf)
getWhitening
in class AbstractBlockCipher
buf
- The buffer into the first 8 bytes of which the whitening
should be placed.protected void bufferEncrypt(int nblocks)
bufferEncrypt
in class AbstractBlockCipher
protected void bufferDecrypt(int nblocks)
bufferDecrypt
in class AbstractBlockCipher
protected byte[] getMAC()
getMAC
in class AbstractBlockCipher
public int getBlockSizeExp()
getBlockSizeExp
in class AbstractBlockCipher
protected int getHeaderLength()
AbstractBlockCipher
getHeaderLength
in class AbstractBlockCipher
protected int getMACLength()
AbstractBlockCipher
getMACLength
in class AbstractBlockCipher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |