Package org.h2.security
Interface BlockCipher
public interface BlockCipher
A block cipher is a data encryption algorithm that operates on blocks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBlocks sizes are always multiples of this number. -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrypt(byte[] bytes, int off, int len) Decrypt a number of bytes.voidencrypt(byte[] bytes, int off, int len) Encrypt a number of bytes.intGet the length of the key in bytes.voidsetKey(byte[] key) Set the encryption key used for encrypting and decrypting.
-
Field Details
-
ALIGN
static final int ALIGNBlocks sizes are always multiples of this number.- See Also:
-
-
Method Details
-
setKey
void setKey(byte[] key) Set the encryption key used for encrypting and decrypting. The key needs to be 16 bytes long.- Parameters:
key- the key
-
encrypt
void encrypt(byte[] bytes, int off, int len) Encrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Parameters:
bytes- the byte arrayoff- the start indexlen- the number of bytes to encrypt
-
decrypt
void decrypt(byte[] bytes, int off, int len) Decrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Parameters:
bytes- the byte arrayoff- the start indexlen- the number of bytes to decrypt
-
getKeyLength
int getKeyLength()Get the length of the key in bytes.- Returns:
- the length of the key
-