public final class MbedTLS
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
AESCBC |
static int |
AESCFB128 |
static int |
AESCFB8 |
static int |
AESECB |
static int |
MBEDTLS_AES_DECRYPT |
static int |
MBEDTLS_AES_ENCRYPT |
| Constructor and Description |
|---|
MbedTLS(int algo,
int mode)
Creates a new MbedTLS, with the given AES algorithm and AES Mode.
|
| Modifier and Type | Method and Description |
|---|---|
int |
aesCrypt(int length,
java.lang.Integer ivOff,
byte[] iv,
byte[] input,
byte[] output)
Buffer Encryption/Decryption (depending on modeMBED)
|
int |
aesSetkey(byte[] key,
int keylen)
Sets initial key before Encryption/Decryption
|
static short |
CRC16(short polynom,
short preloadValue,
int length,
byte[] buffer)
Allows to compute 16 bits CRC on a given byte buffer (always starts from the first byte of the buffer)
|
public static final int MBEDTLS_AES_DECRYPT
public static final int MBEDTLS_AES_ENCRYPT
public static final int AESECB
public static final int AESCBC
public static final int AESCFB128
public static final int AESCFB8
public MbedTLS(int algo,
int mode)
algo - AES algorithm to use for encryption
mode - AES mode
public int aesSetkey(byte[] key,
int keylen)
key - decryption keykeybits - must be 128, 192 or 256public int aesCrypt(int length,
java.lang.Integer ivOff,
byte[] iv,
byte[] input,
byte[] output)
length - length of the input dataivOff - offset in IV (updated after use)
(only for AESCFB128)iv - initialization vector (updated after use)input - buffer holding the input dataoutput - buffer holding the output datapublic static short CRC16(short polynom,
short preloadValue,
int length,
byte[] buffer)
polynom - the polynom used in thepreloadValue - the starting value of the calculation. Usually 0xFFFFlength - the number of bytes of the buffer used for the computation.buffer - array of the bytes used for computation