com.sun.jersey.oauth.signature
Class HMAC_SHA1
java.lang.Object
com.sun.jersey.oauth.signature.HMAC_SHA1
- All Implemented Interfaces:
- OAuthSignatureMethod
public class HMAC_SHA1
- extends Object
- implements OAuthSignatureMethod
An OAuth signature method that implements HMAC-SHA1.
- Author:
- Hubert A. Le Van Gong , Paul C. Bryan
Method Summary |
String |
name()
Returns the name of this signature method, as negotiated through the
OAuth protocol. |
String |
sign(String elements,
OAuthSecrets secrets)
Generates the HMAC-SHA1 signature of OAuth request elements. |
boolean |
verify(String elements,
OAuthSecrets secrets,
String signature)
Verifies the HMAC-SHA1 signature of OAuth request elements. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME
public static final String NAME
- See Also:
- Constant Field Values
HMAC_SHA1
public HMAC_SHA1()
name
public String name()
- Description copied from interface:
OAuthSignatureMethod
- Returns the name of this signature method, as negotiated through the
OAuth protocol.
- Specified by:
name
in interface OAuthSignatureMethod
sign
public String sign(String elements,
OAuthSecrets secrets)
- Generates the HMAC-SHA1 signature of OAuth request elements.
- Specified by:
sign
in interface OAuthSignatureMethod
- Parameters:
elements
- the combined OAuth elements to sign.secrets
- the shared secrets used to sign the request.
- Returns:
- the OAuth signature, in base64-encoded form.
verify
public boolean verify(String elements,
OAuthSecrets secrets,
String signature)
- Verifies the HMAC-SHA1 signature of OAuth request elements.
- Specified by:
verify
in interface OAuthSignatureMethod
- Parameters:
elements
- OAuth elements signature is to be verified against.secrets
- the shared secrets for verifying the signature.signature
- base64-encoded OAuth signature to be verified.
- Returns:
- true if the signature matches the secrets and data.
Copyright © 2013 Oracle Corporation. All Rights Reserved.