Package tigase.form

Class SignatureCalculator


  • public class SignatureCalculator
    extends Object
    • Constructor Detail

      • SignatureCalculator

        public SignatureCalculator()
      • SignatureCalculator

        public SignatureCalculator​(String oauthConsumerKey,
                                   String oauthConsumerSecret)
      • SignatureCalculator

        public SignatureCalculator​(String oauthToken,
                                   String oauthTokenSecret,
                                   String oauthConsumerKey,
                                   String oauthConsumerSecret)
    • Method Detail

      • addEmptyFields

        public void addEmptyFields​(Form form)
      • getOauthConsumerKey

        public String getOauthConsumerKey()
        Returns:
        the oauthConsumerKey
      • setOauthConsumerKey

        public void setOauthConsumerKey​(String oauthConsumerKey)
        Parameters:
        oauthConsumerKey - the oauthConsumerKey to set
      • getOauthConsumerSecret

        public String getOauthConsumerSecret()
        Returns:
        the oauthConsumerSecret
      • setOauthConsumerSecret

        public void setOauthConsumerSecret​(String oauthConsumerSecret)
        Parameters:
        oauthConsumerSecret - the oauthConsumerSecret to set
      • getOauthToken

        public String getOauthToken()
        Returns:
        the oauthToken
      • setOauthToken

        public void setOauthToken​(String oauthToken)
        Parameters:
        oauthToken - the oauthToken to set
      • getOauthTokenSecret

        public String getOauthTokenSecret()
        Returns:
        the oauthTokenSecret
      • setOauthTokenSecret

        public void setOauthTokenSecret​(String oauthTokenSecret)
        Parameters:
        oauthTokenSecret - the oauthTokenSecret to set
      • isMethodSupported

        public boolean isMethodSupported​(String fOauthSignatureMethod)
      • sign

        public void sign​(JID to,
                         String nonce,
                         long timestamp,
                         Form form)
                  throws InvalidKeyException,
                         NoSuchAlgorithmException
        Sign given Form. Signature will be added to form.
        Parameters:
        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.
        Throws:
        InvalidKeyException
        NoSuchAlgorithmException
      • key

        protected SecretKey key​(byte[] key)
      • randomString

        protected String randomString()