com.sun.jersey.oauth.signature
Class HMAC_SHA1

java.lang.Object
  extended by com.sun.jersey.oauth.signature.HMAC_SHA1
All Implemented Interfaces:
OAuthSignatureMethod

public class HMAC_SHA1
extends java.lang.Object
implements OAuthSignatureMethod

An OAuth signature method that implements HMAC-SHA1.

Author:
Hubert A. Le Van Gong , Paul C. Bryan

Field Summary
static java.lang.String NAME
           
 
Constructor Summary
HMAC_SHA1()
           
 
Method Summary
 java.lang.String name()
          Returns the name of this signature method, as negotiated through the OAuth protocol.
 java.lang.String sign(java.lang.String elements, OAuthSecrets secrets)
          Generates the HMAC-SHA1 signature of OAuth request elements.
 boolean verify(java.lang.String elements, OAuthSecrets secrets, java.lang.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
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values
Constructor Detail

HMAC_SHA1

public HMAC_SHA1()
Method Detail

name

public java.lang.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 java.lang.String sign(java.lang.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(java.lang.String elements,
                      OAuthSecrets secrets,
                      java.lang.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 © 2011 Sun Microsystems, Inc. All Rights Reserved.