Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.security.authentication.util
Class Signer

    java.lang.Object
      org.apache.hadoop.security.authentication.util.Signer

    public class Signer

extends Object

Signs strings and verifies signed strings using a SHA digest.

Constructor Summary
`Signer(byte[] secret)` Creates a Signer instance using the specified secret.

Method Summary
`protected String` | `computeSignature(String str)` Returns then signature of a string.
`String` | `sign(String str)` Returns a signed string.
`String` | `verifyAndExtract(String signedStr)` Verifies a signed string and extracts the original string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Signer

    public Signer(byte[] secret)

  Creates a Signer instance using the specified secret.

  Parameters:
    `secret` - secret to use for creating the digest.

Method Detail

### sign

    public String sign(String str)

  Returns a signed string.

  The signature '&s=SIGNATURE' is appended at the end of the string.

  Parameters:
    `str` - string to sign.
  Returns:
    the signed string.

### verifyAndExtract

    public String verifyAndExtract(String signedStr)
                            throws SignerException

  Verifies a signed string and extracts the original string.

  Parameters:
    `signedStr` - the signed string to verify and extract.
  Returns:
    the extracted original string.
  Throws:
    `SignerException` - thrown if the given string is not a signed string or if the signature is invalid.

### computeSignature

    protected String computeSignature(String str)

  Returns then signature of a string.

  Parameters:
    `str` - string to sign.
  Returns:
    the signature for the string.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation