public class RSA_SHA1SignatureMethod extends Object implements OAuthSignatureMethod
Modifier and Type | Field and Description |
---|---|
static String |
SIGNATURE_NAME
The name of this RSA-SHA1 signature method ("RSA-SHA1").
|
Constructor and Description |
---|
RSA_SHA1SignatureMethod(PrivateKey key)
Construct a RSA-SHA1 signature method with the given RSA-SHA1 private key.
|
RSA_SHA1SignatureMethod(PrivateKey privateKey,
PublicKey publicKey)
Construct a RSA-SHA1 signature method with the given RSA-SHA1 public/private key pair.
|
RSA_SHA1SignatureMethod(PublicKey key)
Construct a RSA-SHA1 signature method with the given RSA-SHA1 public key.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
The name of this RSA-SHA1 signature method ("RSA-SHA1").
|
PrivateKey |
getPrivateKey()
The private key.
|
PublicKey |
getPublicKey()
The private key.
|
String |
sign(String signatureBaseString)
The Signature Base String is signed using the Consumer’s RSA private key per RFC3447 section 8.2.1, where K is the Consumer’s RSA private key,
M the Signature Base String, and S is the result signature octet string:
S = RSASSA-PKCS1-V1_5-SIGN (K, M)
oauth_signature is set to S, first base64-encoded per RFC2045 section 6.8, then URL-encoded per Parameter Encoding. |
void |
verify(String signatureBaseString,
String signature)
Verify the signature of the given signature base string.
|
public static final String SIGNATURE_NAME
public RSA_SHA1SignatureMethod(PrivateKey privateKey, PublicKey publicKey)
privateKey
- The private key.publicKey
- The public key.public RSA_SHA1SignatureMethod(PrivateKey key)
key
- The key.public RSA_SHA1SignatureMethod(PublicKey key)
key
- The key.public String getName()
getName
in interface OAuthSignatureMethod
public String sign(String signatureBaseString)
S = RSASSA-PKCS1-V1_5-SIGN (K, M)
oauth_signature is set to S, first base64-encoded per RFC2045 section 6.8, then URL-encoded per Parameter Encoding.sign
in interface OAuthSignatureMethod
signatureBaseString
- The signature base string.UnsupportedOperationException
- If there is no private key.public void verify(String signatureBaseString, String signature) throws InvalidSignatureException
verify
in interface OAuthSignatureMethod
signatureBaseString
- The signature base string.signature
- The signature.InvalidSignatureException
- If the signature is invalid for the specified base string.UnsupportedOperationException
- If there is no public key.public PrivateKey getPrivateKey()
public PublicKey getPublicKey()
Copyright © 2019. All rights reserved.