public class CryptoUtils
extends java.lang.Object
| Constructor and Description |
|---|
CryptoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
addMAC(byte[] key,
byte[] data)
Add mac byte [ ].
|
static byte[] |
addMAC(long[] key,
byte[] data)
Add mac byte [ ].
|
static byte[] |
invert(byte[] key)
Invert byte [ ].
|
static byte[] |
removeMAC(byte[] key,
byte[] data)
Check the MAC and return the verified content or null if the verification failed
|
static byte[] |
removeMAC(long[] key,
byte[] data)
Remove mac byte [ ].
|
static long |
safeSipHash(long k0,
long k1,
byte[] msg)
Compute a safe SipHash of a given input by computing the
forward hash, the hash of the reversed input and finally the
hash of the two concatenated hashes.
|
static byte[] |
unwrap(byte[] key,
byte[] data)
Unwrap byte [ ].
|
static byte[] |
wrap(byte[] key,
byte[] data)
Wrap byte [ ].
|
public static byte[] wrap(byte[] key,
byte[] data)
key - the keydata - the datapublic static byte[] unwrap(byte[] key,
byte[] data)
key - the keydata - the datapublic static byte[] addMAC(long[] key,
byte[] data)
key - the keydata - the datapublic static byte[] addMAC(byte[] key,
byte[] data)
key - the keydata - the datapublic static byte[] removeMAC(byte[] key,
byte[] data)
key - the keydata - the datapublic static byte[] removeMAC(long[] key,
byte[] data)
key - the keydata - the datapublic static long safeSipHash(long k0,
long k1,
byte[] msg)
This should prevent having meaningful collisions. If two contents have colliding hashes, this means that the concatenation of their forward and reverse hashes are collisions for SipHah, quite unlikely.
k0 - the k 0k1 - the k 1msg - the msgpublic static byte[] invert(byte[] key)
key - the key