• R/O
  • HTTP
  • SSH
  • HTTPS

BetaProject: 提交

Mail送信先確認プログラムβプロジェクト


Commit MetaInfo

修訂f54e0948a532801919c197b09af167b9af0148c1 (tree)
時間2011-05-08 04:31:48
作者Takuya Ono <takuya-o@user...>
CommiterTakuya Ono

Log Message

MOD: Use default cacerts KeyStore file.

Change Summary

差異

Binary files a/deploy/mdc.zip and b/deploy/mdc.zip differ
--- a/src/org/jent/checksmtp/ssl/RespondingX509TrustManager.java
+++ b/src/org/jent/checksmtp/ssl/RespondingX509TrustManager.java
@@ -30,60 +30,10 @@ public class RespondingX509TrustManager implements X509TrustManager {
3030
3131 public RespondingX509TrustManager() throws Exception {
3232 // create a "default" JSSE X509TrustManager.
33- File file = null;
34- FileInputStream cacertsFileInputStream = null;
35- char cacertsPass[] = null;
36-
37- //Create&load KeyStore
38- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
39- //KeyStore ks = KeyStore.getInstance("JKS");
40- //ks.load(new FileInputStream("trustedCerts"), "passphrase".toCharArray());
41- try {
42- //Check file at sytem property javax.net.ssl.trustStore.
43- String cacertsFileName = System.getProperty("javax.net.ssl.trustStore");
44- if (cacertsFileName != null) {
45- file = new File(cacertsFileName);
46- System.out.println("System property javax.net.ssl.trustStore:"
47- + cacertsFileName);
48- }
49- if (file == null) {
50- //Check Default trustStore
51- char SEP = File.separatorChar;
52- String cacertsDirName = System.getProperty("java.home") + SEP + "lib"
53- + SEP + "security";
54- file = new File(cacertsDirName, "jssecacerts");
55- if (!file.canRead()) {
56- System.err.println("NotFound:" + file.getPath());
57- file = new File(cacertsDirName, "cacerts");
58- }
59- }
60- if (!file.canRead()) {
61- System.err.println("NotFound:" + file.getPath());
62- cacertsFileInputStream = null;
63- } else {
64- cacertsFileInputStream = new FileInputStream(file);
65- System.err.println("Load trustStore:" + file.getPath());
66- String cacertsPassString = System.getProperty("javax.net.ssl.trustStorePassword");
67- if (cacertsPassString != null) {
68- cacertsPass = cacertsPassString.toCharArray();
69- }
70- }
71- } catch (NullPointerException npEx) {
72- npEx.printStackTrace(System.out);
73- cacertsFileInputStream = null;
74- } catch (FileNotFoundException fnfEx) {
75- System.err.println("CanNotRead(" + fnfEx + "):" + file.getPath());
76- cacertsFileInputStream = null;
77- } catch (SecurityException ex) {
78- cacertsFileInputStream = null;
79- System.err.println("CanNotRead(" + ex + "):" + file.getPath());
80- }
81- ks.load(cacertsFileInputStream, cacertsPass);
82- cacertsFileInputStream.close();
83-
33+ //KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
8434 TrustManagerFactory tmf =
8535 TrustManagerFactory.getInstance("PKIX");
86- tmf.init(ks);
36+ tmf.init((KeyStore)null); //Default KeyStore by null argument.
8737
8838 TrustManager tms[] = tmf.getTrustManagers();
8939
Show on old repository browser