Class SignatureTool

java.lang.Object
com.alphapay.api.tools.SignatureTool

public class SignatureTool extends Object
  • Constructor Details

    • SignatureTool

      public SignatureTool()
  • Method Details

    • sign

      public static String sign(String httpMethod, String path, String merchantCode, String reqTimeStr, String nonce, String reqBody, String merchantPrivateKey) throws Exception
      Throws:
      Exception
    • verify

      public static boolean verify(String httpMethod, String path, String merchantCode, String rspTimeStr, String nonce, String rspBody, String signature, String alphaPayPublicKey) throws Exception
      Throws:
      Exception
    • genSignContent

      public static String genSignContent(String httpMethod, String path, String merchantCode, String timeString, String nonce, String content)
    • sign

      public static String sign(String reqContent, String merchantPrivateKey) throws Exception
      Sign the contents of the merchant request
      Parameters:
      reqContent - = httpMethod + " " + uriWithQueryString + "\n" + merchantCode + "." + timeString + "." + reqBody;
      merchantPrivateKey - the private key
      Returns:
      the string
      Throws:
      Exception - the exception
    • verify

      public static boolean verify(String rspContent, String signature, String alphaPayPublicKey) throws Exception
      Check the response of AlphaPay
      Parameters:
      rspContent - = httpMethod + " " + uriWithQueryString + "\n" + merchantCode + "." + timeString + "." + rspBody;
      signature - the signature
      alphaPayPublicKey - the public key
      Returns:
      the boolean
      Throws:
      Exception - the exception
    • setBase64Encryptor

      public static void setBase64Encryptor(Base64Encryptor customBase64Encryptor)