org.sakaiproject.hybrid.util
Class Signature
java.lang.Object
org.sakaiproject.hybrid.util.Signature
public class Signature
- extends Object
Copied from nakamura/libraries/utils/src/main/java/org/sakaiproject/nakamura/util/
Signature.java@70078352b144921ee03a4f2e1d17a3a9b9a2b231
Utility to calculate signatures for information.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hmacSha1Algorithm
protected transient String hmacSha1Algorithm
Signature
public Signature()
- Throws:
IllegalStateException - If there are any run time problems getting an instance.
Signature
protected Signature(String algorithm)
- Intended to be used for unit testing only.
- Parameters:
algorithm -
calculateRFC2104HMAC
public String calculateRFC2104HMAC(String data,
String key)
throws InvalidKeyException
- Calculate an RFC2104 compliant HMAC (Hash-based Message Authentication
Code)
- Parameters:
data - The data to be signed. This data is pushed through a hex
converter in this method, so there is no need to do this
before generating the HMAC.key - The signing key.
- Returns:
- The Base64-encoded RFC 2104-compliant HMAC signature. By default
it is not URL safe.
- Throws:
InvalidKeyException - This is the exception for invalid Keys (invalid encoding,
wrong length, uninitialized, etc).- See Also:
calculateRFC2104HMACWithEncoding(String, String, boolean)
calculateRFC2104HMACWithEncoding
public String calculateRFC2104HMACWithEncoding(String data,
String key,
boolean urlSafe)
throws InvalidKeyException
- Calculate an RFC2104 compliant HMAC (Hash-based Message Authentication
Code)
- Parameters:
data - The data to be signed. This data is pushed through a hex
converter in this method, so there is no need to do this
before generating the HMAC.key - The signing key.urlSafe - true if the token needs to be URL safe.
- Returns:
- The Base64-encoded RFC 2104-compliant HMAC signature.
- Throws:
InvalidKeyException - This is the exception for invalid Keys (invalid encoding,
wrong length, uninitialized, etc).
Copyright © 2009-2013 The Sakai Foundation. All Rights Reserved.