HMAC512ServiceTest.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.maxkey.crypto.signature;
  17. import org.dromara.maxkey.crypto.jwt.Hmac512Service;
  18. import com.nimbusds.jose.JOSEException;
  19. public class HMAC512ServiceTest {
  20. public static void main(String[] args) throws JOSEException {
  21. // TODO Auto-generated method stub
  22. String key ="7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg";
  23. Hmac512Service HMAC512Service = new Hmac512Service(key);
  24. String sign = HMAC512Service.sign("{\"sub\":\"hkkkk\"}");
  25. System.out.println(sign);
  26. boolean isverify = HMAC512Service.verify(sign);
  27. System.out.println(isverify);
  28. }
  29. }