Package org.openstreetmap.josm.io
Class CertificateAmendment
java.lang.Object
org.openstreetmap.josm.io.CertificateAmendment
Class to add missing root certificates to the list of trusted certificates
for TLS connections.
The added certificates are deemed trustworthy by the main web browsers and
operating systems, but not included in some distributions of Java.
The certificates are added in-memory at each start, nothing is written to disk.
- Since:
- 9995
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA certificate amendment.static classAn embedded certificate amendment.static classA certificate amendment relying on native platform certificate store. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CertificateAmendment.EmbeddedCertAmend[]Certificates embedded in JOSMprivate static final CertificateAmendment.NativeCertAmend[]Certificates looked into platform native keystore and not embedded in JOSM. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdd missing root certificates to the list of trusted certificates for TLS connections.private static booleancertificateIsMissing(KeyStore keyStore, X509Certificate crt) Check if the certificate is missing and needs to be added to the keystore.private static booleancheckAndAddCertificate(MessageDigest md, X509Certificate cert, CertificateAmendment.CertAmend certAmend, KeyStore keyStore)
-
Field Details
-
CERT_AMEND
Certificates embedded in JOSM -
PLATFORM_CERT_AMEND
Certificates looked into platform native keystore and not embedded in JOSM. Identifiers must match Windows/macOS keystore aliases and Unix filenames for efficient search. To find correct values, see:
-
-
Constructor Details
-
CertificateAmendment
private CertificateAmendment()
-
-
Method Details
-
addMissingCertificates
Add missing root certificates to the list of trusted certificates for TLS connections.- Throws:
IOException- if an I/O error occursGeneralSecurityException- if a security error occurs
-
checkAndAddCertificate
private static boolean checkAndAddCertificate(MessageDigest md, X509Certificate cert, CertificateAmendment.CertAmend certAmend, KeyStore keyStore) throws CertificateEncodingException, KeyStoreException, InvalidAlgorithmParameterException -
certificateIsMissing
private static boolean certificateIsMissing(KeyStore keyStore, X509Certificate crt) throws KeyStoreException, InvalidAlgorithmParameterException Check if the certificate is missing and needs to be added to the keystore.- Parameters:
keyStore- the keystorecrt- the certificate- Returns:
- true, if the certificate is not contained in the keystore
- Throws:
InvalidAlgorithmParameterException- if the keystore does not contain at least one trusted certificate entryKeyStoreException- if the keystore has not been initialized
-