Package io.pravega.common.util
Class CertificateUtils
- java.lang.Object
-
- io.pravega.common.util.CertificateUtils
-
public class CertificateUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CertificateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.KeyStorecreateTrustStore(java.lang.String certFilePath)Creates a truststore with certificates from PEM-encoded (ASCII) or DER-encoded (binary) file at the specifiedcertFilePath.static java.security.cert.X509Certificate[]extractCerts(java.lang.String certFilePath)Retrieves certificates from PEM-encoded (ASCII) or DER-encoded (binary) file at the specifiedcertFilePath.static java.lang.StringtoString(java.security.cert.X509Certificate[] certificateChain)
-
-
-
Method Detail
-
extractCerts
public static java.security.cert.X509Certificate[] extractCerts(java.lang.String certFilePath) throws java.security.cert.CertificateException, java.io.IOExceptionRetrieves certificates from PEM-encoded (ASCII) or DER-encoded (binary) file at the specifiedcertFilePath.- Parameters:
certFilePath- the path of the file containing a certificate(s).- Returns:
- a sequence of X509Certificate certificates found in the file.
- Throws:
java.security.cert.CertificateException- if parsing of the certificate failsjava.io.IOException- if a file in not found at the specifiedcertFilePathor some other IO error occurs.java.lang.NullPointerException- ifcertFilePathis nulljava.lang.IllegalArgumentException- ifcertFilePathis empty
-
toString
public static java.lang.String toString(java.security.cert.X509Certificate[] certificateChain)
-
createTrustStore
public static java.security.KeyStore createTrustStore(java.lang.String certFilePath) throws java.security.cert.CertificateException, java.io.IOException, java.security.KeyStoreException, java.security.NoSuchAlgorithmExceptionCreates a truststore with certificates from PEM-encoded (ASCII) or DER-encoded (binary) file at the specifiedcertFilePath.- Parameters:
certFilePath- the path of the file containing a certificate chain.- Returns:
- a truststore loaded with the certificate chain present in the specified
certFilePath - Throws:
java.security.cert.CertificateException- if parsing of the certificate failsjava.io.IOException- if a file in not found at the specifiedcertFilePath, or some other IO error occursjava.security.KeyStoreException- if creating an instance of the truststore fails for some reason.java.security.NoSuchAlgorithmException- if the algorithm used for verifying rhe truststore's integrity is missingjava.lang.NullPointerException- ifcertFilePathis nulljava.lang.IllegalArgumentException- ifcertFilePathis empty
-
-