Package com.cybersource.authsdk.http
Class SignatureGenerator
java.lang.Object
com.cybersource.authsdk.http.SignatureGenerator
Module to generate digital signature which is then passed to signature header
parameter
The signature is created from the following values and then signed with
Secret Key
host - Sandbox
(apitest.cybersource.com) or Production
(api.cybersource.com) hostname
date - HTTP-date with format as defined by RFC7231
request-target - Should be in format of httpMethod: path
Example : post /pts/v2/payments
Digest - Only needed for POST calls
v-c-merchant-id - Cybersource Merchant ID found on EBC portal
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SignatureGenerator
public SignatureGenerator(MerchantConfig merchantConfig) throws InvalidKeyException, NoSuchAlgorithmException, ConfigException - Parameters:
merchantConfig- -contains all information of merchant.- Throws:
InvalidKeyException- - if key is not valid.NoSuchAlgorithmException- - if algorithm is not available.ConfigException
-
-
Method Details
-
signatureGeneration
- Returns:
- generated signature.
- Throws:
NoSuchAlgorithmException- - if algorithm is not available.InvalidKeyException- - if key is not valid.
-
getRequestTarget
- Parameters:
requestType- - GET/PUT/POST/PATCH/DELETE- Returns:
- request target as per request type.
-