HMAC512Service to Hmac512Service

This commit is contained in:
shimingxy
2024-11-07 14:42:29 +08:00
parent 18f6f86b24
commit 205acfaaeb
6 changed files with 14 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ import com.nimbusds.jose.jwk.KeyUse;
import com.nimbusds.jose.jwk.OctetSequenceKey;
import com.nimbusds.jose.util.Base64URL;
public class HMAC512Service {
public class Hmac512Service {
public static final String MXK_AUTH_JWK = "mxk_auth_jwk";
@@ -39,11 +39,11 @@ public class HMAC512Service {
MACVerifier verifier;
public HMAC512Service() {
public Hmac512Service() {
super();
}
public HMAC512Service(String secretString) throws JOSEException {
public Hmac512Service(String secretString) throws JOSEException {
Base64URL secret=new Base64URL(secretString);
OctetSequenceKey octKey= new OctetSequenceKey.Builder(secret)
.keyID(MXK_AUTH_JWK)

View File

@@ -17,7 +17,7 @@
package org.maxkey.crypto.signature;
import org.dromara.maxkey.crypto.jwt.HMAC512Service;
import org.dromara.maxkey.crypto.jwt.Hmac512Service;
import com.nimbusds.jose.JOSEException;
@@ -26,7 +26,7 @@ public class HMAC512ServiceTest {
public static void main(String[] args) throws JOSEException {
// TODO Auto-generated method stub
String key ="7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg";
HMAC512Service HMAC512Service = new HMAC512Service(key);
Hmac512Service HMAC512Service = new Hmac512Service(key);
String sign = HMAC512Service.sign("{\"sub\":\"hkkkk\"}");
System.out.println(sign);
boolean isverify = HMAC512Service.verify(sign);