fanchangjifen commented on PR #11930:
URL: https://github.com/apache/apisix/pull/11930#issuecomment-2634169231
for java
```
<dependency>
<groupId>com.tencent.kona</groupId>
<artifactId>kona-crypto</artifactId>
<version>1.0.10</version>
</dependency>
public static String hmacSm3Base64Str(final String key, final String data) {
try {
Security.addProvider(new KonaCryptoProvider());
SecretKey secretKey = new
SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSM3");
Mac hmac = Mac.getInstance("HmacSM3");
hmac.init(secretKey);
byte[] hmacSm3Bytes =
hmac.doFinal(data.getBytes(StandardCharsets.UTF_8));
return new String(Base64.encodeBase64(hmacSm3Bytes),
StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]