equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, 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. |
7 * published by the Free Software Foundation. |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8048622 8134232 |
26 * @bug 8048622 8134232 |
27 * @summary Checks that PKCS#11 keystore can't be loaded with wrong password |
27 * @summary Checks that PKCS#11 keystore can't be loaded with wrong password |
28 * @library ../ |
28 * @library /test/lib ../ |
29 * @modules jdk.crypto.cryptoki |
29 * @modules jdk.crypto.cryptoki |
30 * @run main/othervm LoadKeystore |
30 * @run main/othervm LoadKeystore |
31 * @run main/othervm LoadKeystore sm policy |
31 * @run main/othervm LoadKeystore sm policy |
32 */ |
32 */ |
33 |
33 |
41 import java.util.Collections; |
41 import java.util.Collections; |
42 |
42 |
43 public class LoadKeystore extends SecmodTest { |
43 public class LoadKeystore extends SecmodTest { |
44 |
44 |
45 public static void main(String[] args) throws Exception { |
45 public static void main(String[] args) throws Exception { |
|
46 if (args.length > 1 && "sm".equals(args[0])) { |
|
47 System.setProperty("java.security.policy", |
|
48 BASE + File.separator + args[1]); |
|
49 } |
|
50 |
46 if (!initSecmod()) { |
51 if (!initSecmod()) { |
47 return; |
52 return; |
48 } |
53 } |
49 |
54 |
50 String configName = BASE + SEP + "nss.cfg"; |
55 String configName = BASE + SEP + "nss.cfg"; |
53 System.out.println("Add provider " + p); |
58 System.out.println("Add provider " + p); |
54 System.out.println(); |
59 System.out.println(); |
55 Security.addProvider(p); |
60 Security.addProvider(p); |
56 |
61 |
57 if (args.length > 1 && "sm".equals(args[0])) { |
62 if (args.length > 1 && "sm".equals(args[0])) { |
58 System.setProperty("java.security.policy", |
|
59 BASE + File.separator + args[1]); |
|
60 System.setSecurityManager(new SecurityManager()); |
63 System.setSecurityManager(new SecurityManager()); |
61 } |
64 } |
62 |
65 |
63 try { |
66 try { |
64 System.out.println("Load keystore with wrong type"); |
67 System.out.println("Load keystore with wrong type"); |