|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectccs.crypt.Cipher
ccs.crypt.AbstractBlockCipher
public abstract class AbstractBlockCipher
A cipher which works on a sequence of blocks. Its ciphertext has a variable-length header, followed by zero or more blocks of length 2^n, for int n, where n = 0 or n >= 3, followed by a fixed-length trailer which may also contain ciphertext. (Typically this contains a padded terminal block which needs special treatment, followed by a MAC.)
| Field Summary | |
|---|---|
protected byte[] |
buffer
Stores multiple ciphertext blocks to allow bulk transformation; this is is generally more efficient. |
| Fields inherited from class ccs.crypt.Cipher |
|---|
passwd |
| Constructor Summary | |
|---|---|
protected |
AbstractBlockCipher()
|
| Method Summary | |
|---|---|
protected abstract void |
bufferDecrypt(int nblocks)
Decrypt the number of blocks specified from the internal buffer, updating the MAC with the result. |
protected abstract void |
bufferEncrypt(int nblocks)
Encrypt the number of blocks specified from the internal buffer, updating the MAC with the result. |
protected boolean |
checkRegistered(java.lang.Object user,
boolean isThrow)
|
abstract int |
getBlockSizeExp()
The logarithm to base 2 of the block size of the cipher in bytes. |
long |
getCiphertextLength(long plainlen,
boolean isSelfDelimit)
returns the encrypted length of a given length of plaintext. |
protected abstract int |
getHeaderLength()
The size of the header, without any self-delimitation info. |
protected abstract byte[] |
getMAC()
Obtain the MAC for the stream. |
protected abstract int |
getMACLength()
The size of the MAC. |
long |
getPlaintextLength(long cipherlen,
boolean isSelfDelimit)
returns the length of plaintext resulting from a given length of ciphertext - the inverse of getCiphertextLength. |
protected int |
getTrailerLength()
Determine the length of the fixed-length trailer. |
protected abstract void |
getWhitening(byte[] buf)
Produce and return 8 bytes (exactly) of "whitening". |
protected void |
register(java.lang.Object user)
|
protected void |
unregister(java.lang.Object user)
|
| Methods inherited from class ccs.crypt.Cipher |
|---|
getInputStream, getOutputStream, getPasswd, out, setPasswd |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected byte[] buffer
| Constructor Detail |
|---|
protected AbstractBlockCipher()
| Method Detail |
|---|
protected void register(java.lang.Object user)
protected void unregister(java.lang.Object user)
protected boolean checkRegistered(java.lang.Object user,
boolean isThrow)
public long getCiphertextLength(long plainlen,
boolean isSelfDelimit)
Ciphers are not supposed to attempt compression.
getCiphertextLength in class Cipherplainlen - the length of plaintext.isSelfDelimit - Whether the stream includes its own length.
Cipher. Note that this may be
odd.
public long getPlaintextLength(long cipherlen,
boolean isSelfDelimit)
getCiphertextLength. However, this
is generally difficult or impossible to calculate for a block cipher since
an unknown amount of padding is present.
getPlaintextLength in class Ciphercipherlen - the length of ciphertext.isSelfDelimit - Whether the stream includes its own length.
protected int getTrailerLength()
protected abstract void getWhitening(byte[] buf)
buf - The buffer into the first 8 bytes of which the whitening
should be placed.protected abstract void bufferEncrypt(int nblocks)
protected abstract void bufferDecrypt(int nblocks)
public abstract int getBlockSizeExp()
protected abstract byte[] getMAC()
protected abstract int getHeaderLength()
protected abstract int getMACLength()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||