File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\security\BlockCipher.java.html

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