Class RsaSha1Method
- java.lang.Object
-
- org.glassfish.jersey.oauth1.signature.RsaSha1Method
-
- All Implemented Interfaces:
OAuth1SignatureMethod
public final class RsaSha1Method extends java.lang.Object implements OAuth1SignatureMethod
An OAuth signature method that implements RSA-SHA1.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringBEGIN_CERTprivate static java.lang.StringKEY_TYPEprivate static java.util.logging.LoggerLOGGERstatic java.lang.StringNAMEprivate static java.lang.StringSIGNATURE_ALGORITHM
-
Constructor Summary
Constructors Constructor Description RsaSha1Method()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringname()Returns the name of this signature method, as negotiated through the OAuth protocol.java.lang.Stringsign(java.lang.String baseString, OAuth1Secrets secrets)Generates the RSA-SHA1 signature of OAuth request elements.booleanverify(java.lang.String elements, OAuth1Secrets secrets, java.lang.String signature)Verifies the RSA-SHA1 signature of OAuth request elements.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
SIGNATURE_ALGORITHM
private static final java.lang.String SIGNATURE_ALGORITHM
- See Also:
- Constant Field Values
-
KEY_TYPE
private static final java.lang.String KEY_TYPE
- See Also:
- Constant Field Values
-
BEGIN_CERT
private static final java.lang.String BEGIN_CERT
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:OAuth1SignatureMethodReturns the name of this signature method, as negotiated through the OAuth protocol.- Specified by:
namein interfaceOAuth1SignatureMethod- Returns:
- Signature method name.
-
sign
public java.lang.String sign(java.lang.String baseString, OAuth1Secrets secrets) throws InvalidSecretExceptionGenerates the RSA-SHA1 signature of OAuth request elements.- Specified by:
signin interfaceOAuth1SignatureMethod- Parameters:
baseString- the combined OAuth elements to sign.secrets- the secrets object containing the private key for generating the signature.- Returns:
- the OAuth signature, in base64-encoded form.
- Throws:
InvalidSecretException- if the supplied secret is not valid.
-
verify
public boolean verify(java.lang.String elements, OAuth1Secrets secrets, java.lang.String signature) throws InvalidSecretExceptionVerifies the RSA-SHA1 signature of OAuth request elements.- Specified by:
verifyin interfaceOAuth1SignatureMethod- Parameters:
elements- OAuth elements signature is to be verified against.secrets- the secrets object containing the public key for verifying the signature.signature- base64-encoded OAuth signature to be verified.- Returns:
- true if the signature matches the secrets and data.
- Throws:
InvalidSecretException- if the supplied secret is not valid.
-
-