Changeset 13451 in josm for trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
- Timestamp:
- 2018-02-24T17:14:11+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r13450 r13451 59 59 import java.security.spec.X509EncodedKeySpec; 60 60 import java.util.ArrayList; 61 import java.util.Arrays; 61 62 import java.util.Collection; 62 63 import java.util.Enumeration; … … 64 65 import java.util.Locale; 65 66 import java.util.Properties; 67 import java.util.concurrent.ExecutionException; 66 68 67 69 import javax.swing.JOptionPane; … … 441 443 public X509Certificate getX509Certificate(NativeCertAmend certAmend) 442 444 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { 445 // Make a web request to target site to force Windows to update if needed its trust root store from its certificate trust list 446 // A better, but a lot more complex method might be to get certificate list from Windows Registry with PowerShell 447 // using (Get-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\SystemCertificates\\AuthRoot\\AutoUpdate').EncodedCtl) 448 // then decode it using CertUtil -dump or calling CertCreateCTLContext API using JNI, and finally find and decode the certificate 449 try { 450 // https://stackoverflow.com/a/41618979/2257172 451 Utils.execOutput(Arrays.asList("powershell", "-Command", 452 "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" + 453 "Invoke-WebRequest " + certAmend.getWebSite())); 454 } catch (ExecutionException | InterruptedException e) { 455 Logging.error(e); 456 } 457 // Get Windows Trust Root Store 443 458 KeyStore ks = getRootKeystore(); 444 459 // Search by alias (fast)
Note:
See TracChangeset
for help on using the changeset viewer.