public class Encryption extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Encryption.KeyIv
KeyIV represents a secret key and an IV.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ALGO |
static String |
ALGO_KEY |
static int |
GCM_TLEN |
static int |
IV_LEN |
static int |
KEY_LEN |
static int |
KEYMATERIAL_LEN |
| Constructor and Description |
|---|
Encryption() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decryptData(byte[] dataEnc,
byte[] keyMaterial)
This method decrypts the data using the same encryption-method
as is defined in the header of this class.
|
static byte[] |
encryptData(byte[] data,
byte[] keyMaterial)
Encrypts the data using the encryption defined in the header.
|
public static final String ALGO
public static final String ALGO_KEY
public static final int KEY_LEN
public static final int IV_LEN
public static final int GCM_TLEN
public static final int KEYMATERIAL_LEN
public static byte[] encryptData(byte[] data,
byte[] keyMaterial)
throws CothorityCryptoException
data - the data to encryptkeyMaterial - random string of length IV_LEN + keylength.
The first IV_LEN bytes are taken as iv, the
rest is taken as the symmetric symmetricKey,
which must be at least 16 bytes long.CothorityCryptoException - if there's a problem with the cryptographypublic static byte[] decryptData(byte[] dataEnc,
byte[] keyMaterial)
throws CothorityCryptoException
dataEnc - the encrypted data from the skipchainkeyMaterial - the decrypted keyMaterialCothorityCryptoException - if there's a problem with the cryptographyCopyright © 2019. All rights reserved.