Package nl.altindag.ssl.util
Class CertificateUtils
java.lang.Object
nl.altindag.ssl.util.CertificateUtils
- Author:
- Hakan Altindag
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertToPem(Certificate certificate) convertToPem(List<X509Certificate> certificates) static <T extends Certificate>
StringgenerateAlias(T certificate) static <T extends Certificate>
Map<String,T> generateAliases(List<T> certificates) static <T extends Certificate>
StringgenerateUniqueAlias(T certificate, Predicate<String> aliasPredicate) static List<X509Certificate>static List<X509Certificate>getCertificatesFromExternalSource(Proxy proxy, String url) static List<X509Certificate>getCertificatesFromExternalSource(Proxy proxy, PasswordAuthentication passwordAuthentication, String url) getCertificatesFromExternalSourceAsPem(Proxy proxy, String url) getCertificatesFromExternalSourceAsPem(Proxy proxy, PasswordAuthentication passwordAuthentication, String url) static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(String... urls) static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, String... urls) static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, PasswordAuthentication passwordAuthentication, String... urls) static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, PasswordAuthentication passwordAuthentication, List<String> urls) static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, List<String> urls) static Map<String,List<X509Certificate>> getCertificatesFromExternalSourcesAsPem(Proxy proxy, String... urls) getCertificatesFromExternalSourcesAsPem(Proxy proxy, PasswordAuthentication passwordAuthentication, String... urls) getCertificatesFromExternalSourcesAsPem(Proxy proxy, PasswordAuthentication passwordAuthentication, List<String> urls) getCertificatesFromExternalSourcesAsPem(Proxy proxy, List<String> urls) static List<X509Certificate>static List<X509Certificate>static <T extends Certificate>
booleanisSelfSigned(T certificate) static List<Certificate>loadCertificate(InputStream... certificateStreams) Loads certificates from multiple InputStreams and maps it into a list ofCertificate.static List<Certificate>loadCertificate(String... certificatePaths) Loads certificates from the classpath and maps it into a list ofCertificate.static List<Certificate>loadCertificate(Path... certificatePaths) Loads certificates from the filesystem and maps it into a list ofCertificate.static List<Certificate>parseDerCertificate(InputStream certificateStream) static List<Certificate>parseP7bCertificate(String certificateContent) Parses P7B formatted certificates containing a header as -----BEGIN PKCS7----- and footer as -----END PKCS7----- with a base64 encoded data between the header and footer.static List<Certificate>parsePemCertificate(String certificateContent) Parses PEM formatted certificates containing a header as -----BEGIN CERTIFICATE----- and footer as -----END CERTIFICATE----- or header as -----BEGIN PKCS7----- and footer as -----END PKCS7----- with a base64 encoded data between the header and footer.static <T extends Certificate>
void
-
Method Details
-
generateAlias
-
generateAliases
-
generateUniqueAlias
public static <T extends Certificate> String generateUniqueAlias(T certificate, Predicate<String> aliasPredicate) -
write
-
loadCertificate
Loads certificates from the classpath and maps it into a list ofCertificate.
Supported input format: PEM, P7B and DER -
loadCertificate
Loads certificates from the filesystem and maps it into a list ofCertificate.
Supported input format: PEM, P7B and DER -
loadCertificate
Loads certificates from multiple InputStreams and maps it into a list ofCertificate.
Supported input format: PEM, P7B and DER -
parsePemCertificate
Parses PEM formatted certificates containing a header as -----BEGIN CERTIFICATE----- and footer as -----END CERTIFICATE----- or header as -----BEGIN PKCS7----- and footer as -----END PKCS7----- with a base64 encoded data between the header and footer. -
parseP7bCertificate
Parses P7B formatted certificates containing a header as -----BEGIN PKCS7----- and footer as -----END PKCS7----- with a base64 encoded data between the header and footer. -
parseDerCertificate
-
getJdkTrustedCertificates
-
getSystemTrustedCertificates
-
getCertificatesFromExternalSource
-
getCertificatesFromExternalSource
-
getCertificatesFromExternalSource
public static List<X509Certificate> getCertificatesFromExternalSource(Proxy proxy, PasswordAuthentication passwordAuthentication, String url) -
getCertificatesFromExternalSourceAsPem
-
getCertificatesFromExternalSourceAsPem
-
getCertificatesFromExternalSourceAsPem
public static List<String> getCertificatesFromExternalSourceAsPem(Proxy proxy, PasswordAuthentication passwordAuthentication, String url) -
getCertificatesFromExternalSources
-
getCertificatesFromExternalSources
-
getCertificatesFromExternalSources
public static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, PasswordAuthentication passwordAuthentication, String... urls) -
getCertificatesFromExternalSources
-
getCertificatesFromExternalSources
-
getCertificatesFromExternalSources
public static Map<String,List<X509Certificate>> getCertificatesFromExternalSources(Proxy proxy, PasswordAuthentication passwordAuthentication, List<String> urls) -
getCertificatesFromExternalSourcesAsPem
-
getCertificatesFromExternalSourcesAsPem
-
getCertificatesFromExternalSourcesAsPem
-
getCertificatesFromExternalSourcesAsPem
-
getCertificatesFromExternalSourcesAsPem
-
getCertificatesFromExternalSourcesAsPem
-
convertToPem
-
convertToPem
-
isSelfSigned
-