All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.GBSEcom.simple.Hmac Maven / Gradle / Ivy

Go to download

Java SDK to be used with a First Data Gateway account. This SDK has been created and packaged to offer the easiest way to integrate your application into the First Data Gateway. This SDK gives you the ability to run transactions such as sales, preauthorizations, postauthorizations, credits, voids, and returns; transaction inquiries; setting up scheduled payments and much more.

There is a newer version: 1.15.0
Show newest version
package com.github.GBSEcom.simple;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
import java.util.Optional;

public class Hmac {
	private final HmacUtils hmacHelper;
	private final Hex hexHelper;

	public Hmac(final String secretKey) {
		hmacHelper = new HmacUtils(HmacAlgorithms.HMAC_SHA_256, secretKey);
		hexHelper = new Hex();
	}

	public String sign(final String msg) {
		return Optional.of(msg)
			.map(hmacHelper::hmac)
			.map(hexHelper::encode)
			.map(Base64::encodeBase64String)
			.get();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy