Class Signer
java.lang.Object
org.apache.hadoop.security.authentication.util.Signer
Signs strings and verifies signed strings using a SHA digest.
-
Constructor Summary
ConstructorsConstructorDescriptionSigner(SignerSecretProvider secretProvider) Creates a Signer instance using the specified SignerSecretProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckSignatures(String rawValue, String originalSignature) protected StringcomputeSignature(byte[] secret, String str) Returns then signature of a string.Returns a signed string.verifyAndExtract(String signedStr) Verifies a signed string and extracts the original string.
-
Constructor Details
-
Signer
Creates a Signer instance using the specified SignerSecretProvider. The SignerSecretProvider should already be initialized.- Parameters:
secretProvider- The SignerSecretProvider to use
-
-
Method Details
-
sign
Returns a signed string.- Parameters:
str- string to sign.- Returns:
- the signed string.
-
verifyAndExtract
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
Returns then signature of a string.- Parameters:
secret- The secret to usestr- string to sign.- Returns:
- the signature for the string.
-
checkSignatures
- Throws:
SignerException
-