Signer (Apache Hadoop Auth 3.5.0 API)
Description: declaration: package: org.apache.hadoop.security.authentication.util, class: Signer

Package 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

  Constructors
  Constructor
  Description
  `Signer(SignerSecretProvider secretProvider)`
  Creates a Signer instance using the specified SignerSecretProvider.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `checkSignatures(String rawValue, String originalSignature)`
  `protected String`
  `computeSignature(byte[] secret, 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 Details

  - ### Signer

    public Signer(SignerSecretProvider secretProvider)
    Creates a Signer instance using the specified SignerSecretProvider. The SignerSecretProvider should already be initialized.
    Parameters:
      `secretProvider` - The SignerSecretProvider to use

- ## Method Details

  - ### sign

    public String sign(String str)
    Returns a signed 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(byte[] secret, String str)
    Returns then signature of a string.
    Parameters:
      `secret` - The secret to use
      `str` - string to sign.
    Returns:
      the signature for the string.

  - ### checkSignatures

    protected void checkSignatures(String rawValue, String originalSignature) throws SignerException
    Throws:
      `SignerException`