Package com.nimbusds.jose.util
Class X509CertChainUtils
- java.lang.Object
-
- com.nimbusds.jose.util.X509CertChainUtils
-
public class X509CertChainUtils extends Object
X.509 certificate chain utilities.- Version:
- 2020-02-22
- Author:
- Vladimir Dzhuvinov
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<X509Certificate>
parse(File pemFile)
Parses a X.509 certificate chain from the specified PEM-encoded representation.static List<X509Certificate>
parse(String pemString)
Parses a X.509 certificate chain from the specified PEM-encoded representation.static List<X509Certificate>
parse(List<Base64> b64List)
Parses a X.509 certificate chain from the specified Base64-encoded DER-encoded representation.static List<UUID>
store(KeyStore trustStore, List<X509Certificate> certChain)
Stores a X.509 certificate chain into the specified Java trust (key) store.static List<Base64>
toBase64List(List<Object> jsonArray)
Converts the specified JSON array of strings to a list of Base64 encoded objects.
-
-
-
Method Detail
-
toBase64List
public static List<Base64> toBase64List(List<Object> jsonArray) throws ParseException
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
public static List<X509Certificate> parse(List<Base64> b64List) throws ParseException
Parses a 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
public static List<X509Certificate> parse(File pemFile) throws IOException, CertificateException
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 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:
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 a 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.
-
-