Class CertificateUtils

java.lang.Object
nl.altindag.desidero.CertificateUtils

final class CertificateUtils extends Object
  • Field Details

  • Constructor Details

    • CertificateUtils

      private CertificateUtils()
  • Method Details

    • generateAlias

      static <T extends Certificate> String generateAlias(T certificate)
    • loadCertificate

      static List<Certificate> loadCertificate(Path path)
      Loads certificates from the filesystem and maps it into a list of Certificate.
      Supported input format: PEM, P7B and DER
    • loadCertificate

      private static <T> List<Certificate> loadCertificate(Function<T,InputStream> resourceMapper, T[] resources)
    • parseCertificate

      private static List<Certificate> parseCertificate(InputStream certificateStream)
      Tries to map the InputStream to a list of Certificate. It assumes that the content of the InputStream is either PEM, P7B or DER. The InputStream will copied into an OutputStream so it can be read multiple times.
    • isPemFormatted

      private static boolean isPemFormatted(String certificateContent)
    • isP7bFormatted

      private static boolean isP7bFormatted(String certificateContent)
    • parsePemCertificate

      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.
    • parseP7bCertificate

      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.
    • parseCertificate

      private static List<Certificate> parseCertificate(Matcher certificateMatcher)
    • parseDerCertificate

      static List<Certificate> parseDerCertificate(InputStream certificateStream)