|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.common.crypto.Crypto
public final class Crypto
Cryptographic utility functions.
| Field Summary | |
|---|---|
static int |
CIPHER_KEY_LEN
Use keys of this length for encryption operations |
static int |
HMAC_SHA1_LEN
Length of HMAC SHA1 output |
static SecureRandom |
RAND
Use this random number generator instead of creating your own. |
| Method Summary | |
|---|---|
static byte[] |
aes128cbcDecrypt(byte[] key,
byte[] cipherText)
AES-128-CBC decryption. |
static byte[] |
aes128cbcDecryptWithIv(byte[] key,
byte[] iv,
byte[] cipherText,
int offset)
AES-128-CBC decryption with a particular IV. |
static byte[] |
aes128cbcEncrypt(byte[] key,
byte[] plain)
AES-128-CBC encryption. |
static byte[] |
aes128cbcEncryptWithIV(byte[] key,
byte[] iv,
byte[] plain)
AES-128-CBC encryption with a given IV. |
static byte[] |
concat(byte[] a,
byte[] b)
Concatenate two byte arrays. |
static byte[] |
getRandomBytes(int numBytes)
Returns strong random bytes. |
static String |
getRandomDigits(int len)
|
static String |
getRandomString(int numBytes)
Gets a hex encoded random string. |
static byte[] |
hmacSha1(byte[] key,
byte[] in)
HMAC sha1 |
static void |
hmacSha1Verify(byte[] key,
byte[] in,
byte[] expected)
Verifies an HMAC SHA1 hash. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final SecureRandom RAND
public static final int CIPHER_KEY_LEN
public static final int HMAC_SHA1_LEN
| Method Detail |
|---|
public static String getRandomString(int numBytes)
numBytes - number of bytes of randomness.public static String getRandomDigits(int len)
public static byte[] getRandomBytes(int numBytes)
numBytes - number of bytes of randomness
public static byte[] hmacSha1(byte[] key,
byte[] in)
throws GeneralSecurityException
key - the key must be at least 8 bytes in length.in - byte array to HMAC.
GeneralSecurityException
public static void hmacSha1Verify(byte[] key,
byte[] in,
byte[] expected)
throws GeneralSecurityException
key - in - expected -
GeneralSecurityException
public static byte[] aes128cbcEncrypt(byte[] key,
byte[] plain)
throws GeneralSecurityException
key - plain -
GeneralSecurityException
public static byte[] aes128cbcEncryptWithIV(byte[] key,
byte[] iv,
byte[] plain)
throws GeneralSecurityException
key - iv - plain -
GeneralSecurityException
public static byte[] aes128cbcDecrypt(byte[] key,
byte[] cipherText)
throws GeneralSecurityException
key - cipherText -
GeneralSecurityException
public static byte[] aes128cbcDecryptWithIv(byte[] key,
byte[] iv,
byte[] cipherText,
int offset)
throws GeneralSecurityException
key - decryption keyiv - initial vector for decryptioncipherText - cipher text to decryptoffset - offset into cipher text to begin decryption
GeneralSecurityException
public static byte[] concat(byte[] a,
byte[] b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||