Package com.nimbusds.jose.util
Class X509CertChainUtils
java.lang.Object
com.nimbusds.jose.util.X509CertChainUtils
X.509 certificate chain utilities.
- Version:
- 2024-09-12
- Author:
- Vladimir Dzhuvinov
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<X509Certificate>
Parses a X.509 certificate chain from the specified PEM-encoded representation.static List<X509Certificate>
Parses an X.509 certificate chain from the specified PEM-encoded representation.static List<X509Certificate>
Parses an X.509 certificate chain from the specified Base64-encoded DER-encoded representation.store
(KeyStore trustStore, List<X509Certificate> certChain) Stores an X.509 certificate chain into the specified Java trust (key) store.toBase64List
(List<Object> jsonArray) Converts the specified JSON array of strings to a list of Base64 encoded objects.
-
Method Details
-
toBase64List
Converts the specified JSON array of strings to a list of Base64 encoded objects.- Parameters:
jsonArray
- The JSON array of string,null
if not specified.- Returns:
- The Base64 list,
null
if not specified. - Throws:
ParseException
- If parsing failed.
-
parse
Parses an X.509 certificate chain from the specified Base64-encoded DER-encoded representation.- Parameters:
b64List
- The Base64-encoded DER-encoded X.509 certificate chain,null
if not specified.- Returns:
- The X.509 certificate chain,
null
if not specified. - Throws:
ParseException
- If parsing failed.
-
parse
Parses a X.509 certificate chain from the specified PEM-encoded representation. PEM-encoded objects that are not X.509 certificates are ignored. Requires BouncyCastle.- Parameters:
pemFile
- The PEM-encoded X.509 certificate chain file. Must not benull
.- Returns:
- The X.509 certificate chain, empty list if no certificates are found.
- Throws:
IOException
- On I/O exception.CertificateException
- On a certificate exception.
-
parse
public static List<X509Certificate> parse(String pemString) throws IOException, CertificateException Parses an X.509 certificate chain from the specified PEM-encoded representation. PEM-encoded objects that are not X.509 certificates are ignored. Requires BouncyCastle.- Parameters:
pemString
- The PEM-encoded X.509 certificate chain. Must not benull
.- Returns:
- The X.509 certificate chain, empty list if no certificates are found.
- Throws:
IOException
- On I/O exception.CertificateException
- On a certificate exception.
-
store
public static List<UUID> store(KeyStore trustStore, List<X509Certificate> certChain) throws KeyStoreException Stores an X.509 certificate chain into the specified Java trust (key) store. The name (alias) for each certificate in the store is a generated UUID.- Parameters:
trustStore
- The trust (key) store. Must be initialised and notnull
.certChain
- The X.509 certificate chain. Must not benull
.- Returns:
- The UUIDs for the stored entry.
- Throws:
KeyStoreException
- On a key store exception.
-