Methods Summary |
---|
protected byte[] | decrypt(byte type, byte[] fragment)Retrieves the fragment of the Plaintext structure of
the specified type from the provided data.
return decrypt(type, fragment, 0, fragment.length);
|
protected abstract byte[] | decrypt(byte type, byte[] fragment, int offset, int len)Retrieves the fragment of the Plaintext structure of
the specified type from the provided data.
|
protected byte[] | encrypt(byte type, byte[] fragment)Creates the GenericStreamCipher or GenericBlockCipher
data structure for specified data of specified type.
return encrypt(type, fragment, 0, fragment.length);
|
protected abstract byte[] | encrypt(byte type, byte[] fragment, int offset, int len)Creates the GenericStreamCipher or GenericBlockCipher
data structure for specified data of specified type.
|
protected int | getContentSize(int generic_cipher_size)Returns the minimal upper bound of the content size enclosed
into the Generic[Stream|Generic]Cipher structure of specified size.
For stream ciphers the returned value will be exact value.
//it does not take the padding of block ciphered structures
//into account (so returned value can be greater than actual)
return decCipher.getOutputSize(generic_cipher_size)-hash_size;
|
protected int | getFragmentSize(int content_size)Returns the size of the Generic[Stream|Generic]Cipher structure
corresponding to the content data of specified size.
return encCipher.getOutputSize(content_size+hash_size);
|
protected int | getMinFragmentSize()Returns the minimal possible size of the
Generic[Stream|Generic]Cipher structure under this
connection state.
// block ciphers return value with padding included
return encCipher.getOutputSize(1+hash_size); // 1 byte for data
|
protected static void | incSequenceNumber(byte[] seq_num)Increments the sequence number.
int octet = 7;
while (octet >= 0) {
seq_num[octet] ++;
if (seq_num[octet] == 0) {
// characteristic overflow, so
// carrying a number in adding
octet --;
} else {
return;
}
}
|
protected void | shutdown()Shutdownes the protocol. It will be impossiblke to use the instance
after the calling of this method.
encCipher = null;
decCipher = null;
for (int i=0; i<write_seq_num.length; i++) {
write_seq_num[i] = 0;
read_seq_num[i] = 0;
}
|