equal
deleted
inserted
replaced
46 } |
46 } |
47 |
47 |
48 // in the future, all accesses to the system cacerts keystore should |
48 // in the future, all accesses to the system cacerts keystore should |
49 // go through this class. but not right now. |
49 // go through this class. but not right now. |
50 /* |
50 /* |
51 private final static String javaHome = |
51 private static final String javaHome = |
52 (String)AccessController.doPrivileged(new GetPropertyAction("java.home")); |
52 (String)AccessController.doPrivileged(new GetPropertyAction("java.home")); |
53 |
53 |
54 private final static char SEP = File.separatorChar; |
54 private static final char SEP = File.separatorChar; |
55 |
55 |
56 private static KeyStore caCerts; |
56 private static KeyStore caCerts; |
57 |
57 |
58 private static KeyStore getKeyStore(String type, String name, |
58 private static KeyStore getKeyStore(String type, String name, |
59 char[] password) throws IOException { |
59 char[] password) throws IOException { |
77 /** |
77 /** |
78 * Return a KeyStore with the contents of the lib/security/cacerts file. |
78 * Return a KeyStore with the contents of the lib/security/cacerts file. |
79 * The file is only opened once per JVM invocation and the contents |
79 * The file is only opened once per JVM invocation and the contents |
80 * cached subsequently. |
80 * cached subsequently. |
81 * |
81 * |
82 public synchronized static KeyStore getCaCerts() throws IOException { |
82 public static synchronized KeyStore getCaCerts() throws IOException { |
83 if (caCerts != null) { |
83 if (caCerts != null) { |
84 return caCerts; |
84 return caCerts; |
85 } |
85 } |
86 String name = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts"; |
86 String name = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts"; |
87 caCerts = getKeyStore(null, name, null); |
87 caCerts = getKeyStore(null, name, null); |