Package com.alphapay.api.tools
Class SignatureTool
java.lang.Object
com.alphapay.api.tools.SignatureTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenSignContent(String httpMethod, String path, String merchantCode, String timeString, String nonce, String content) static voidsetBase64Encryptor(Base64Encryptor customBase64Encryptor) static StringSign the contents of the merchant requeststatic Stringsign(String httpMethod, String path, String merchantCode, String reqTimeStr, String nonce, String reqBody, String merchantPrivateKey) static booleanCheck the response of AlphaPaystatic booleanverify(String httpMethod, String path, String merchantCode, String rspTimeStr, String nonce, String rspBody, String signature, String alphaPayPublicKey)
-
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
-
sign
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 signaturealphaPayPublicKey- the public key- Returns:
- the boolean
- Throws:
Exception- the exception
-
setBase64Encryptor
-