mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 01:48:33 +08:00
ReciprocalUtils compatible jdk 17
This commit is contained in:
parent
328fcc53f4
commit
f4e076d82c
@ -53,6 +53,16 @@ public final class ReciprocalUtils {
|
|||||||
public static final String AES = "AES";
|
public static final String AES = "AES";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
if(System.getProperty("java.version").startsWith("1.8")) {
|
||||||
|
try {
|
||||||
|
Security.addProvider(new com.sun.crypto.provider.SunJCE());
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] encode(byte[] simpleBytes, SecretKey secretKey, String algorithm) {
|
public static byte[] encode(byte[] simpleBytes, SecretKey secretKey, String algorithm) {
|
||||||
// Create the ciphers
|
// Create the ciphers
|
||||||
Cipher ecipher;
|
Cipher ecipher;
|
||||||
@ -155,7 +165,6 @@ public final class ReciprocalUtils {
|
|||||||
|
|
||||||
public static SecretKey generatorDefaultKey(String algorithm) {
|
public static SecretKey generatorDefaultKey(String algorithm) {
|
||||||
try {
|
try {
|
||||||
Security.addProvider(new com.sun.crypto.provider.SunJCE());
|
|
||||||
String secretKey = defaultKey;
|
String secretKey = defaultKey;
|
||||||
if (algorithm.equals(Algorithm.DES)) {
|
if (algorithm.equals(Algorithm.DES)) {
|
||||||
secretKey = defaultKey.substring(0, 8);
|
secretKey = defaultKey.substring(0, 8);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user