public class RSA_SHA1 extends OAuthSignatureMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PRIVATE_KEY |
private java.security.PrivateKey |
privateKey |
static java.lang.String |
PUBLIC_KEY |
private java.security.PublicKey |
publicKey |
static java.lang.String |
X509_CERTIFICATE |
_ACCESSOR
Constructor and Description |
---|
RSA_SHA1() |
Modifier and Type | Method and Description |
---|---|
private java.security.PrivateKey |
getPrivateKeyFromDer(byte[] privateKeyObject) |
private java.security.PrivateKey |
getPrivateKeyFromPem(java.lang.String pem) |
private java.security.PublicKey |
getPublicKeyFromDer(byte[] publicKeyObject) |
private java.security.PublicKey |
getPublicKeyFromDerCert(byte[] certObject) |
private java.security.PublicKey |
getPublicKeyFromPem(java.lang.String pem) |
protected java.lang.String |
getSignature(java.lang.String baseString)
Compute the signature for the given base string.
|
protected void |
initialize(java.lang.String name,
OAuthAccessor accessor) |
protected boolean |
isValid(java.lang.String signature,
java.lang.String baseString)
Decide whether the signature is valid.
|
private java.security.PrivateKey |
loadPrivateKey(java.lang.Object privateKeyObject)
Load private key from various sources, including
A PrivateKey object
A string buffer for PEM
A byte array with PKCS#8 encoded key
|
private java.security.PublicKey |
loadPublicKey(java.lang.Object publicKeyObject,
boolean isCert)
Load a public key from key file or certificate.
|
private byte[] |
sign(byte[] message) |
private boolean |
verify(byte[] signature,
byte[] message) |
base64Encode, decodeBase64, equals, equals, getBaseString, getConsumerSecret, getSignature, getTokenSecret, newMethod, newSigner, normalizeParameters, normalizeUrl, registerMethodClass, setConsumerSecret, setTokenSecret, sign, unregisterMethod, validate
public static final java.lang.String PRIVATE_KEY
public static final java.lang.String PUBLIC_KEY
public static final java.lang.String X509_CERTIFICATE
private java.security.PrivateKey privateKey
private java.security.PublicKey publicKey
protected void initialize(java.lang.String name, OAuthAccessor accessor) throws OAuthException
initialize
in class OAuthSignatureMethod
OAuthException
private java.security.PublicKey getPublicKeyFromDerCert(byte[] certObject) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
private java.security.PublicKey getPublicKeyFromDer(byte[] publicKeyObject) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
private java.security.PublicKey getPublicKeyFromPem(java.lang.String pem) throws java.security.GeneralSecurityException, java.io.IOException
java.security.GeneralSecurityException
java.io.IOException
private java.security.PrivateKey getPrivateKeyFromDer(byte[] privateKeyObject) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
private java.security.PrivateKey getPrivateKeyFromPem(java.lang.String pem) throws java.security.GeneralSecurityException, java.io.IOException
java.security.GeneralSecurityException
java.io.IOException
protected java.lang.String getSignature(java.lang.String baseString) throws OAuthException
OAuthSignatureMethod
getSignature
in class OAuthSignatureMethod
OAuthException
protected boolean isValid(java.lang.String signature, java.lang.String baseString) throws OAuthException
OAuthSignatureMethod
isValid
in class OAuthSignatureMethod
OAuthException
private byte[] sign(byte[] message) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
private boolean verify(byte[] signature, byte[] message) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
private java.security.PrivateKey loadPrivateKey(java.lang.Object privateKeyObject) throws java.io.IOException, java.security.GeneralSecurityException
privateKeyObject
- java.io.IOException
java.security.GeneralSecurityException
private java.security.PublicKey loadPublicKey(java.lang.Object publicKeyObject, boolean isCert) throws java.io.IOException, java.security.GeneralSecurityException
publicKeyObject
- The object for public key or certificateisCert
- True if this object is provided as Certificatejava.io.IOException
java.security.GeneralSecurityException