public class SignatureGenerator extends Object
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 and Description |
|---|
SignatureGenerator(MerchantConfig merchantConfig,
String method)
Constructs a signature generator for HTTP signature authentication.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getRequestTarget(String requestType,
String reqTarget)
Formats the request target based on the HTTP request type.
|
String |
signatureGeneration(String requestData,
String reqTarget,
String date)
Generates the HTTP signature for the request.
|
public SignatureGenerator(MerchantConfig merchantConfig, String method) throws InvalidKeyException, NoSuchAlgorithmException, ConfigException
merchantConfig - contains all information of merchantmethod - the HTTP request methodInvalidKeyException - if key is not valid.NoSuchAlgorithmException - if algorithm is not available.ConfigException - if merchant configuration is invalidpublic String signatureGeneration(String requestData, String reqTarget, String date) throws NoSuchAlgorithmException, InvalidKeyException
requestData - the request payload datareqTarget - the request target URL pathdate - the date string for the requestNoSuchAlgorithmException - if algorithm is not available.InvalidKeyException - if key is not valid.public String getRequestTarget(String requestType, String reqTarget)
requestType - the HTTP request type (GET/PUT/POST/PATCH/DELETE)reqTarget - the request target URL pathCopyright © 2026. All rights reserved.