test/sun/security/pkcs11/KeyStore/ClientAuth.java
Print this page
7191662: JCE providers should be located via ServiceLoader
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -25,11 +25,10 @@
import java.net.*;
import java.util.*;
import java.security.*;
import javax.net.*;
import javax.net.ssl.*;
-import java.lang.reflect.*;
public class ClientAuth extends PKCS11Test {
/*
* =============================================================
@@ -221,11 +220,16 @@
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStoreProvider", "SUN");
System.setProperty("javax.net.ssl.trustStorePassword", JKS_PWD);
// perform Security.addProvider of P11 provider
- ProviderLoader.go(System.getProperty("CUSTOM_P11_CONFIG"));
+ Provider p2 = p.configure(System.getProperty("CUSTOM_P11_CONFIG"));
+ if (p2 != null) {
+ Security.addProvider(p2);
+ } else {
+ throw new Exception("Error: PKCS11 provider configuration failed");
+ }
if (debug) {
System.setProperty("javax.net.debug", "all");
}