logs 优化
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
package org.maxkey.crypto;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
@@ -28,6 +29,7 @@ import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.maxkey.util.Instance;
|
||||
import org.maxkey.util.StringGenerator;
|
||||
|
||||
/**
|
||||
@@ -56,11 +58,12 @@ public final class ReciprocalUtils {
|
||||
static {
|
||||
if(System.getProperty("java.version").startsWith("1.8")) {
|
||||
try {
|
||||
Security.addProvider(new com.sun.crypto.provider.SunJCE());
|
||||
Security.addProvider((Provider)Instance.newInstance("com.sun.crypto.provider.SunJCE"));
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//else not need to add see jdk-17\conf\security\java.security,SunJCE
|
||||
}
|
||||
|
||||
public static byte[] encode(byte[] simpleBytes, SecretKey secretKey, String algorithm) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.maxkey.util;
|
||||
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
|
||||
import org.maxkey.client.crypto.ReciprocalUtils;
|
||||
|
||||
public class InstanceTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
if(System.getProperty("java.version").startsWith("1.8")) {
|
||||
System.out.println("1.8");
|
||||
Security.addProvider((Provider)Instance.newInstance("com.sun.crypto.provider.SunJCE"));
|
||||
System.out.println(ReciprocalUtils.encode("ddddd"));
|
||||
|
||||
System.out.println(ReciprocalUtils.encode("ddfs"));
|
||||
}else {
|
||||
System.out.println("other");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user