|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.util.CryptoUtil
A bag of utilities.
Field Summary | |
static java.lang.String |
code_id
|
Constructor Summary | |
CryptoUtil()
|
Method Summary | |
static void |
confirmJCE()
|
static byte[] |
generateMAC(byte[] data,
byte[] secretKey)
Generate a message digest based on a secret key with the default algorithm. |
static byte[] |
generateMD5Hash(byte[] data)
Creates an initialized MD5 Message Digest, updates it with the byte array data passed in, completes the hash computation, resets the digest, and then returns the one-way hash. |
static byte[] |
generatePBEKey(char[] password)
Generate key using PBEWithMD5andDES algorithm |
static byte[] |
generateSHA1Hash(byte[] data)
Creates an initialized SHA-1 Message Digest, updates it with the byte array data passed in, completes the hash computation, resets the digest, and then returns the one-way hash. |
static javax.crypto.Mac |
getMacInstance()
Generate a secure MAC based on the default algorithm. |
static javax.crypto.Mac |
getMacInstance(java.lang.String algorithm)
Generate a secure MAC based on a the specified algorithm. |
static javax.crypto.spec.SecretKeySpec |
getSecretKeySpec(byte[] secretKey)
Generate a secret key spec based on the default algorithm. |
static javax.crypto.spec.SecretKeySpec |
getSecretKeySpec(byte[] secretKey,
java.lang.String algo)
Generate a secret key spec based on the specified algorithm. |
static boolean |
isMD5HashEqual(byte[] hash1,
byte[] hash2)
Compares two digests for equality (byte array compare) |
static java.lang.String |
md5HashtoString(byte[] data)
Base64 encodes an MD5 hash byte array to an ascii string |
static byte[] |
stringToMD5Hash(java.lang.String hashstr)
Base64 decodes a string, which was previously encoded, returning the MD5 hash byte array |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
Constructor Detail |
public CryptoUtil()
Method Detail |
public static byte[] generateMD5Hash(byte[] data) throws WavesetException
WavesetException
public static byte[] generateSHA1Hash(byte[] data) throws WavesetException
WavesetException
public static boolean isMD5HashEqual(byte[] hash1, byte[] hash2) throws WavesetException
WavesetException
public static java.lang.String md5HashtoString(byte[] data)
public static byte[] stringToMD5Hash(java.lang.String hashstr) throws WavesetException
WavesetException
public static byte[] generateMAC(byte[] data, byte[] secretKey) throws WavesetException
WavesetException
public static byte[] generatePBEKey(char[] password) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
public static void confirmJCE() throws ConfigurationError
ConfigurationError:
- Make sure there is a JCE available.
This should always pass since we require 1.4.2.
This method might throw an exception: ConfigurationError
public static javax.crypto.spec.SecretKeySpec getSecretKeySpec(byte[] secretKey) throws ConfigurationError
ConfigurationError
public static javax.crypto.spec.SecretKeySpec getSecretKeySpec(byte[] secretKey, java.lang.String algo) throws ConfigurationError
ConfigurationError
public static javax.crypto.Mac getMacInstance() throws WavesetException
WavesetException
public static javax.crypto.Mac getMacInstance(java.lang.String algorithm) throws ConfigurationError
ConfigurationError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |