Changeset 12241 in josm for trunk/src/org
- Timestamp:
- 2017-05-23T18:31:31+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java
r11944 r12241 49 49 public static class CertAmend { 50 50 private final String id; 51 private final String filename; 51 52 private final String sha256; 52 53 53 CertAmend(String path, String sha256) { 54 this.id = path; 54 CertAmend(String id, String filename, String sha256) { 55 this.id = id; 56 this.filename = filename; 55 57 this.sha256 = sha256; 56 58 } … … 62 64 public final String getId() { 63 65 return id; 66 } 67 68 /** 69 * Returns the certificate filename. 70 * @return filename for both JOSM embedded certificate and platform certificate 71 * @since 12241 72 */ 73 public final String getFilename() { 74 return filename; 64 75 } 65 76 … … 77 88 */ 78 89 private static final CertAmend[] CERT_AMEND = { 79 new CertAmend("resource://data/security/DST_Root_CA_X3.pem", 90 new CertAmend("resource://data/security/DST_Root_CA_X3.pem", "DST_Root_CA_X3.pem", 80 91 "0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739") 81 92 }; … … 86 97 */ 87 98 private static final CertAmend[] PLATFORM_CERT_AMEND = { 88 new CertAmend("Staat der Nederlanden Root CA - G2", 99 new CertAmend("Staat der Nederlanden Root CA - G2", "Staat_der_Nederlanden_Root_CA_-_G2.crt", 89 100 "668c83947da63b724bece1743c31a0e6aed0db8ec5b31be377bb784f91b6716f"), 90 new CertAmend("Government of Netherlands G3", 101 new CertAmend("Government of Netherlands G3", "Staat_der_Nederlanden_Root_CA_-_G3.crt", 91 102 "3c4fb0b95ab8b30032f432b86f535fe172c185d0fd39865837cf36187fa6f428") 92 103 }; -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r12239 r12241 8 8 import java.io.BufferedReader; 9 9 import java.io.File; 10 import java.io.FileInputStream; 10 11 import java.io.IOException; 11 12 import java.net.URI; … … 15 16 import java.nio.file.Path; 16 17 import java.nio.file.Paths; 18 import java.security.KeyStoreException; 19 import java.security.NoSuchAlgorithmException; 20 import java.security.cert.CertificateException; 21 import java.security.cert.CertificateFactory; 22 import java.security.cert.X509Certificate; 17 23 import java.util.Arrays; 18 24 import java.util.List; … … 20 26 21 27 import org.openstreetmap.josm.Main; 28 import org.openstreetmap.josm.io.CertificateAmendment.CertAmend; 22 29 23 30 /** … … 418 425 return Arrays.asList(new File("/usr/local/share/proj"), new File("/usr/share/proj")); 419 426 } 427 428 @Override 429 public X509Certificate getX509Certificate(CertAmend certAmend) 430 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { 431 File f = new File("/usr/share/ca-certificates/mozilla", certAmend.getFilename()); 432 if (f.exists()) { 433 CertificateFactory fact = CertificateFactory.getInstance("X.509"); 434 try (FileInputStream is = new FileInputStream(f)) { 435 return (X509Certificate) fact.generateCertificate(is); 436 } 437 } 438 return null; 439 } 420 440 }
Note:
See TracChangeset
for help on using the changeset viewer.