1 /* |
1 /* |
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
302 * @throws ClassCastException if the class has not extended Provider |
302 * @throws ClassCastException if the class has not extended Provider |
303 */ |
303 */ |
304 public static void loadProviderByClass( |
304 public static void loadProviderByClass( |
305 String provClass, String arg, ClassLoader cl) { |
305 String provClass, String arg, ClassLoader cl) { |
306 |
306 |
307 // For compatibility, SunPKCS11 and OracleUcrypto can still be |
307 // For compatibility, SunPKCS11, OracleUcrypto, and SunMSCAPI |
308 // loadable with -providerClass. |
308 // can still be loadable with -providerClass. |
309 if (provClass.equals("sun.security.pkcs11.SunPKCS11")) { |
309 if (provClass.equals("sun.security.pkcs11.SunPKCS11")) { |
310 loadProviderByName("SunPKCS11", arg); |
310 loadProviderByName("SunPKCS11", arg); |
311 return; |
311 return; |
312 } else if (provClass.equals("com.oracle.security.crypto.UcryptoProvider")) { |
312 } else if (provClass.equals("com.oracle.security.crypto.UcryptoProvider")) { |
313 loadProviderByName("OracleUcrypto", arg); |
313 loadProviderByName("OracleUcrypto", arg); |
314 return; |
314 return; |
|
315 } else if (provClass.equals("sun.security.mscapi.SunMSCAPI")) { |
|
316 loadProviderByName("SunMSCAPI", arg); |
|
317 return; |
315 } |
318 } |
316 |
319 |
317 Provider prov; |
320 Provider prov; |
318 try { |
321 try { |
319 Class<?> clazz = Class.forName(provClass, false, cl); |
322 Class<?> clazz = Class.forName(provClass, false, cl); |