Package net.libyaguide.gpay.sdk.crypto
Class VerificationHashGenerator
java.lang.Object
net.libyaguide.gpay.sdk.crypto.VerificationHashGenerator
Utility class for generating verification hashes using HMAC-SHA256.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateHmacSHA256(String data, String secretKey) Generates an HMAC-SHA256 hash of the given data using the provided secret key.static StringGenerates a verification hash for request/response validation.
-
Constructor Details
-
VerificationHashGenerator
public VerificationHashGenerator()
-
-
Method Details
-
generateHmacSHA256
Generates an HMAC-SHA256 hash of the given data using the provided secret key.- Parameters:
data- The data to hash.secretKey- The secret key for HMAC.- Returns:
- The Base64-encoded HMAC-SHA256 hash.
- Throws:
Exception- if the hashing fails.
-
generateVerificationHash
public static String generateVerificationHash(String hashToken, Map<String, String> params, String secretKey) throws ExceptionGenerates a verification hash for request/response validation.- Parameters:
hashToken- The hash token (salt + password).params- The parameters to include in the hash.secretKey- The secret key for HMAC.- Returns:
- The Base64-encoded verification hash.
- Throws:
Exception- if the hashing fails.
-