01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.security;
07:
08: /**
09: * A block cipher is a data encryption algorithm that operates on blocks.
10: */
11: public interface BlockCipher {
12:
13: /*
14: * Blocks sizes are always multiples of this number
15: */
16: int ALIGN = 16;
17:
18: /**
19: * Set the encryption key used for encrypting and decrypting.
20: *
21: * @param key the key
22: */
23: void setKey(byte[] key);
24:
25: /**
26: * Encrypt a number of bytes. This is done in-place, that
27: * means the bytes are overwritten.
28: *
29: * @param bytes the byte array
30: * @param off the start index
31: * @param len the number of bytes to encrypt
32: */
33: void encrypt(byte[] bytes, int off, int len);
34:
35: /**
36: * Decrypt a number of bytes. This is done in-place, that
37: * means the bytes are overwritten.
38: *
39: * @param bytes the byte array
40: * @param off the start index
41: * @param len the number of bytes to decrypt
42: */
43: void decrypt(byte[] bytes, int off, int len);
44:
45: /**
46: * Get the length of the key in bytes.
47: *
48: * @return the length of the key
49: */
50: int getKeyLength();
51: }
|