Class VerificationHashGenerator

java.lang.Object
net.libyaguide.gpay.sdk.crypto.VerificationHashGenerator

public class VerificationHashGenerator extends Object
Utility class for generating verification hashes using HMAC-SHA256.
  • Constructor Details

    • VerificationHashGenerator

      public VerificationHashGenerator()
  • Method Details

    • generateHmacSHA256

      public static String generateHmacSHA256(String data, String secretKey) throws Exception
      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 Exception
      Generates 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.