Changeset 7206 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-06-01T17:55:24+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r6830 r7206 4 4 import java.io.File; 5 5 import java.io.IOException; 6 import java.security.KeyStore; 7 import java.security.KeyStoreException; 8 import java.security.NoSuchAlgorithmException; 9 import java.security.cert.CertificateException; 6 10 7 11 /** … … 102 106 */ 103 107 public String getOSDescription(); 108 109 /** 110 * Setup system keystore to add JOSM HTTPS certificate (for remote control). 111 * @param privateKeyEntry the JOSM certificate for localhost and associated private key 112 * @throws KeyStoreException in case of error 113 * @throws IOException in case of error 114 * @throws CertificateException in case of error 115 * @throws NoSuchAlgorithmException in case of error 116 * @since 7206 117 */ 118 public void setupHttpsCertificate(KeyStore.PrivateKeyEntry privateKeyEntry) 119 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException; 104 120 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r7082 r7206 16 16 import java.net.URISyntaxException; 17 17 import java.nio.charset.StandardCharsets; 18 import java.security.KeyStore; 19 import java.security.KeyStoreException; 20 import java.security.NoSuchAlgorithmException; 21 import java.security.cert.CertificateException; 18 22 import java.util.Arrays; 19 23 … … 25 29 26 30 /** 27 * see PlatformHook.java 28 * 29 * BTW: THIS IS A STUB. See comments below for details. 31 * {@code PlatformHook} base implementation. 30 32 * 31 33 * Don't write (Main.platform instanceof PlatformHookUnixoid) because other platform … … 364 366 }); 365 367 } 368 369 @Override 370 public void setupHttpsCertificate(KeyStore.PrivateKeyEntry privateKeyEntry) 371 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { 372 // TODO setup HTTPS certificate on Unix systems 373 } 366 374 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r7001 r7206 30 30 import java.io.File; 31 31 import java.io.IOException; 32 import java.security.KeyStore; 33 import java.security.KeyStoreException; 34 import java.security.NoSuchAlgorithmException; 35 import java.security.cert.Certificate; 36 import java.security.cert.CertificateException; 37 import java.util.Enumeration; 38 39 import org.openstreetmap.josm.Main; 32 40 33 41 /** … … 129 137 ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit"; 130 138 } 139 140 @Override 141 public void setupHttpsCertificate(KeyStore.PrivateKeyEntry privateKeyEntry) 142 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { 143 KeyStore ks = KeyStore.getInstance("Windows-ROOT"); 144 ks.load(null, null); 145 Enumeration<String> en = ks.aliases(); 146 while (en.hasMoreElements()) { 147 String alias = en.nextElement(); 148 Certificate c = ks.getCertificate(alias); 149 if (ks.isKeyEntry(alias) && c.equals(privateKeyEntry.getCertificate())) { 150 // JOSM certificate found, return 151 return; 152 } 153 } 154 // JOSM certificate not found, install it 155 Main.info("Adding JOSM localhost certificate to Windows-ROOT keystore"); 156 ks.setEntry("josm_localhost", privateKeyEntry, new KeyStore.PasswordProtection("josm_ssl".toCharArray())); 157 } 131 158 }
Note:
See TracChangeset
for help on using the changeset viewer.