public class CryptoHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SEC_PROV |
| Constructor and Description |
|---|
CryptoHelper() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
crcHash(byte[] input)
Performs CRC32 on an input byte array using the CrcStandard.Crc32Bit parameters
|
static byte[] |
generateRandomBlock(int size)
Generate an array of random bytes given the input length
|
static byte[] |
symmetricDecrypt(byte[] input,
byte[] key)
Decrypts using AES/CBC/PKCS7 with an input byte array and key, using the random IV prepended using AES/ECB/None
|
static byte[] |
symmetricDecrypt(byte[] input,
byte[] key,
Passable<byte[]> iv)
Decrypts using AES/CBC/PKCS7 with an input byte array and key, using the random IV prepended using AES/ECB/None
|
static byte[] |
symmetricDecryptHMACIV(byte[] input,
byte[] key,
byte[] hmacSecret)
Decrypts using AES/CBC/PKCS7 with an input byte array and key, using the IV (comprised of random bytes and the
HMAC-SHA1 of the random bytes and plaintext) prepended using AES/ECB/None
|
static byte[] |
symmetricEncrypt(byte[] input,
byte[] key)
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a random IV prepended using AES/ECB/None
|
static byte[] |
symmetricEncryptWithHMACIV(byte[] input,
byte[] key,
byte[] hmacSecret)
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a IV (comprised of random bytes
and the HMAC-SHA1 of the random bytes and plaintext) prepended using AES/ECB/None
|
static byte[] |
symmetricEncryptWithIV(byte[] input,
byte[] key,
byte[] iv)
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a random IV prepended using AES/ECB/None
|
public static byte[] generateRandomBlock(int size)
size - the size of the block to generatepublic static byte[] crcHash(byte[] input)
input - array to hashpublic static byte[] symmetricDecrypt(byte[] input,
byte[] key)
throws CryptoException
input - array to decryptkey - encryption keyCryptoException - deception while encryptingpublic static byte[] symmetricDecrypt(byte[] input,
byte[] key,
Passable<byte[]> iv)
throws CryptoException
input - array to decryptkey - encryption keyiv - the random IVCryptoException - deception while encryptingpublic static byte[] symmetricEncryptWithIV(byte[] input,
byte[] key,
byte[] iv)
throws CryptoException
input - array to encryptkey - encryption keyiv - the random IVCryptoException - exception while encryptingpublic static byte[] symmetricEncrypt(byte[] input,
byte[] key)
throws CryptoException
input - array to encryptkey - encryption keyCryptoException - exception while encryptingpublic static byte[] symmetricDecryptHMACIV(byte[] input,
byte[] key,
byte[] hmacSecret)
throws CryptoException
input - array to decryptkey - encryption keyhmacSecret - the IVCryptoException - exception while decryptingpublic static byte[] symmetricEncryptWithHMACIV(byte[] input,
byte[] key,
byte[] hmacSecret)
throws CryptoException
input - array to encryptkey - encryption keyhmacSecret - the IVCryptoException - exception while encrypting