|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.noelios.restlet.util.SecurityUtils
public class SecurityUtils
Security data manipulation utilities.
Constructor Summary | |
---|---|
SecurityUtils()
|
Method Summary | |
---|---|
static String |
makeNonce(String secretKey)
Generates a nonce as recommended in section 3.2.1 of RFC-2617, but without the ETag field. |
static byte[] |
toHMac(String source,
String secretKey)
Converts a source string to its HMAC/SHA-1 value. |
static String |
toMd5(String target)
Returns the MD5 digest of the target string. |
static String |
toMd5(String target,
String charsetName)
Returns the MD5 digest of target string. |
static String |
toSha1(String target)
Returns the SHA1 digest of the target string. |
static String |
toSha1(String target,
String charsetName)
Returns the SHA1 digest of target string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SecurityUtils()
Method Detail |
---|
public static String makeNonce(String secretKey)
Base64.encodeBytes(currentTimeMS + ":"
+ md5String(currentTimeMS + ":" + secretKey))
secretKey
- a secret value known only to the creator of the nonce. It's
inserted into the nonce, and can be used later to validate the
nonce.public static byte[] toHMac(String source, String secretKey)
source
- The source string to convert.secretKey
- The secret key to use for conversion.
public static String toMd5(String target)
target
- The string to encode.
public static String toMd5(String target, String charsetName) throws UnsupportedEncodingException
target
- The string to encode.charsetName
- The character set.
UnsupportedEncodingException
public static String toSha1(String target)
target
- The string to encode.
public static String toSha1(String target, String charsetName) throws UnsupportedEncodingException
target
- The string to encode.charsetName
- The character set.
UnsupportedEncodingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |