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

org.bitbucket.gkutiel.JwsSHA256 Maven / Gradle / Ivy

package org.bitbucket.gkutiel;

import static java.nio.charset.StandardCharsets.UTF_8;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

public interface JwsSHA256 extends Jws {
	String getKey();

	@Override default Mac getMac() {
		try {
			final Mac mac = Mac.getInstance("HmacSHA256");
			mac.init(new SecretKeySpec(getKey().getBytes(UTF_8), "HmacSHA256"));
			return mac;
		} catch (final Exception e) {
			throw new RuntimeException(e);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy