Changeset 19650 in josm


Ignore:
Timestamp:
2026-10-21T16:58:33+02:00 (27 hours ago)
Author:
gaben
Message:

fix #24962 - use a TLSv1.3 context when installing amended root certificates

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java

    r19487 r19650  
    235235            TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    236236            tmf.init(keyStore);
    237             SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
     237            SSLContext sslContext = SSLContext.getInstance("TLSv1.3");
    238238            sslContext.init(null, tmf.getTrustManagers(), null);
    239239            SSLContext.setDefault(sslContext);
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java

    r18037 r19650  
    66import net.trajano.commons.testing.UtilityClassTestUtil;
    77import org.junit.jupiter.api.Test;
     8
     9import javax.net.ssl.SSLContext;
     10import java.io.IOException;
     11import java.security.GeneralSecurityException;
     12import java.util.Arrays;
     13import java.util.List;
     14
     15import static org.junit.jupiter.api.Assertions.assertTrue;
    816
    917/**
    … …  
    2028        UtilityClassTestUtil.assertUtilityClassWellDefined(CertificateAmendment.class);
    2129    }
     30
     31    /**
     32     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/24962">Bug #24962</a>.
     33     * Adding missing certificates must not restrict HTTPS connections to TLS 1.2.
     34     * @throws IOException if an I/O error occurs
     35     * @throws GeneralSecurityException if a security error occurs
     36     */
     37    @Test
     38    void testTicket24962() throws IOException, GeneralSecurityException {
     39        CertificateAmendment.addMissingCertificates();
     40        List<String> protocols = Arrays.asList(SSLContext.getDefault().getDefaultSSLParameters().getProtocols());
     41        assertTrue(protocols.contains("TLSv1.3"), protocols::toString);
     42    }
    2243}
Note: See TracChangeset for help on using the changeset viewer.