OpenJDK / bsd-port / jdk9 / jdk
changeset 13531:2eddc3eaef75
8133085: Avoid creating instances of security providers when possible
Reviewed-by: mullan
author | bgopularam |
---|---|
date | Wed, 20 Jan 2016 09:21:57 -0800 |
parents | a35130a8b189 |
children | 859397229dc4 |
files | test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java test/javax/net/ssl/TLS/TestJSSE.java test/sun/security/pkcs11/fips/ImportKeyStore.java |
diffstat | 3 files changed, 5 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Wed Jan 20 08:33:40 2016 -0800 +++ b/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -33,7 +33,6 @@ import java.io.*; import javax.crypto.*; import javax.crypto.spec.*; -import com.sun.crypto.provider.*; public class PerformanceTest { @@ -81,8 +80,6 @@ byte[] in; - SunJCE jce = new SunJCE(); - Security.addProvider(jce); col = new StringBuffer(); printHeadings();
--- a/test/javax/net/ssl/TLS/TestJSSE.java Wed Jan 20 08:33:40 2016 -0800 +++ b/test/javax/net/ssl/TLS/TestJSSE.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 @@ -111,8 +111,6 @@ out.println(" Testing - https://" + LOCAL_IP + ":" + testPort); out.println(" Testing - Protocol : " + testProtocols); out.println(" Testing - Cipher : " + testCipher); - Provider p = new sun.security.ec.SunEC(); - Security.insertProviderAt(p, 1); try { CipherTestUtils.main(new JSSEFactory(LOCAL_IP, testPort, testProtocols, @@ -132,8 +130,6 @@ out.println(" Testing Protocol: " + testProtocol); out.println(" Testing Cipher: " + testCipher); out.println(" Testing Port: " + testPort); - Provider p = new sun.security.ec.SunEC(); - Security.insertProviderAt(p, 1); try { CipherTestUtils.main(new JSSEFactory(null, testPort, testProtocol, testCipher, "Server JSSE"),
--- a/test/sun/security/pkcs11/fips/ImportKeyStore.java Wed Jan 20 08:33:40 2016 -0800 +++ b/test/sun/security/pkcs11/fips/ImportKeyStore.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -48,7 +48,8 @@ public static void main(String[] args) throws Exception { String nssCfg = "--name=NSS\nnssSecmodDirectory=.\n "; // "attributes(*,CKO_PRIVATE_KEY,CKK_DSA) = { CKA_NETSCAPE_DB = 0h00 }"; - Provider p = new sun.security.pkcs11.SunPKCS11(nssCfg); + Provider p = Security.getProvider("SunPKCS11"); + p.configure(nssCfg); KeyStore ks = KeyStore.getInstance("PKCS11", p); ks.load(null, "test12".toCharArray());