Package org.h2.security
Class Fog
java.lang.Object
org.h2.security.Fog
- All Implemented Interfaces:
BlockCipher
A pseudo-encryption algorithm that makes the data appear to be
encrypted. This algorithm is cryptographically extremely weak, and should
only be used to hide data from reading the plain text using a text editor.
-
Field Summary
FieldsFields inherited from interface org.h2.security.BlockCipher
ALIGN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
decrypt
(byte[] bytes, int off, int len) Decrypt a number of bytes.private void
decryptBlock
(byte[] in, byte[] out, int off) void
encrypt
(byte[] bytes, int off, int len) Encrypt a number of bytes.private void
encryptBlock
(byte[] in, byte[] out, int off) int
Get the length of the key in bytes.void
setKey
(byte[] key) Set the encryption key used for encrypting and decrypting.
-
Field Details
-
key
private int key
-
-
Constructor Details
-
Fog
public Fog()
-
-
Method Details
-
encrypt
public void encrypt(byte[] bytes, int off, int len) Description copied from interface:BlockCipher
Encrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Specified by:
encrypt
in interfaceBlockCipher
- Parameters:
bytes
- the byte arrayoff
- the start indexlen
- the number of bytes to encrypt
-
decrypt
public void decrypt(byte[] bytes, int off, int len) Description copied from interface:BlockCipher
Decrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Specified by:
decrypt
in interfaceBlockCipher
- Parameters:
bytes
- the byte arrayoff
- the start indexlen
- the number of bytes to decrypt
-
encryptBlock
private void encryptBlock(byte[] in, byte[] out, int off) -
decryptBlock
private void decryptBlock(byte[] in, byte[] out, int off) -
getKeyLength
public int getKeyLength()Description copied from interface:BlockCipher
Get the length of the key in bytes.- Specified by:
getKeyLength
in interfaceBlockCipher
- Returns:
- the length of the key
-
setKey
public void setKey(byte[] key) Description copied from interface:BlockCipher
Set the encryption key used for encrypting and decrypting. The key needs to be 16 bytes long.- Specified by:
setKey
in interfaceBlockCipher
- Parameters:
key
- the key
-