public class SignatureCalculator extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
SUPPORTED_TYPE |
| Constructor and Description |
|---|
SignatureCalculator() |
SignatureCalculator(String oauthConsumerKey,
String oauthConsumerSecret) |
SignatureCalculator(String oauthToken,
String oauthTokenSecret,
String oauthConsumerKey,
String oauthConsumerSecret) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEmptyFields(Form form) |
String |
calculateSignature(JID to,
Form form)
Calculate signature of given form.
|
protected static String |
escape(String s) |
String |
getOauthConsumerKey() |
String |
getOauthConsumerSecret() |
String |
getOauthToken() |
String |
getOauthTokenSecret() |
protected byte[] |
h(byte[] data) |
protected static byte[] |
hmac(SecretKey key,
byte[] data) |
boolean |
isMethodSupported(String fOauthSignatureMethod) |
protected SecretKey |
key(byte[] key) |
protected String |
randomString() |
void |
setOauthConsumerKey(String oauthConsumerKey) |
void |
setOauthConsumerSecret(String oauthConsumerSecret) |
void |
setOauthToken(String oauthToken) |
void |
setOauthTokenSecret(String oauthTokenSecret) |
void |
sign(JID to,
Form form)
Sign given form with current time.
|
void |
sign(JID to,
String nonce,
long timestamp,
Form form)
Sign given Form.
|
public static final String SUPPORTED_TYPE
protected static byte[] hmac(SecretKey key, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException
public void addEmptyFields(Form form)
public String calculateSignature(JID to, Form form) throws InvalidKeyException, NoSuchAlgorithmException
to - the full destination address, including resource, if any.form - form to sign.InvalidKeyExceptionNoSuchAlgorithmExceptionpublic String getOauthConsumerKey()
public void setOauthConsumerKey(String oauthConsumerKey)
oauthConsumerKey - the oauthConsumerKey to setpublic String getOauthConsumerSecret()
public void setOauthConsumerSecret(String oauthConsumerSecret)
oauthConsumerSecret - the oauthConsumerSecret to setpublic String getOauthToken()
public void setOauthToken(String oauthToken)
oauthToken - the oauthToken to setpublic String getOauthTokenSecret()
public void setOauthTokenSecret(String oauthTokenSecret)
oauthTokenSecret - the oauthTokenSecret to setpublic boolean isMethodSupported(String fOauthSignatureMethod)
public void sign(JID to, Form form) throws InvalidKeyException, NoSuchAlgorithmException
to - the full destination address, including resource, if any.form - form to sign.InvalidKeyExceptionNoSuchAlgorithmExceptionpublic void sign(JID to, String nonce, long timestamp, Form form) throws InvalidKeyException, NoSuchAlgorithmException
to - the full destination address, including resource, if any.nonce - A nonce value that the client has to set. Can be a random alphanumerical string.timestamp - Number of seconds since 1st of January 1970, 00:00:00 GMT. The client has to set this at the
time of signature.form - form to sign.InvalidKeyExceptionNoSuchAlgorithmExceptionprotected byte[] h(byte[] data)
throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionprotected SecretKey key(byte[] key)
protected String randomString()
Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.