File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
util/src/main/java/io/kubernetes/client/util Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 24
24
import java .security .KeyStoreException ;
25
25
import java .security .NoSuchAlgorithmException ;
26
26
import java .security .PrivateKey ;
27
+ import java .security .Provider ;
27
28
import java .security .Security ;
28
29
import java .security .UnrecoverableKeyException ;
29
30
import java .security .cert .Certificate ;
42
43
import org .bouncycastle .util .io .pem .PemWriter ;
43
44
44
45
public class SSLUtils {
46
+
45
47
static {
46
- Security .addProvider (new org .bouncycastle .jce .provider .BouncyCastleProvider ());
48
+ Provider provider ;
49
+ try {
50
+ Class clazz = getProvider ();
51
+ provider = (Provider ) clazz .getDeclaredConstructor (null ).newInstance ();
52
+ } catch (Exception e ) {
53
+ throw new RuntimeException (e );
54
+ }
55
+
56
+ Security .addProvider (provider );
57
+ }
58
+
59
+ public static Class getProvider () throws ClassNotFoundException {
60
+ Class clazz ;
61
+ try {
62
+ clazz = Class .forName ("org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider" );
63
+ } catch (ClassNotFoundException cnf ) {
64
+ clazz = Class .forName ("org.bouncycastle.jce.provider.BouncyCastleProvider" );
65
+ }
66
+ return clazz ;
47
67
}
48
68
49
69
public static boolean isNotNullOrEmpty (String val ) {
You can’t perform that action at this time.
0 commit comments