Class PemReader


  • final class PemReader
    extends java.lang.Object
    Reads a PEM file and converts it into a list of DERs so that they are imported into a KeyStore easily.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern BODY  
      private static java.util.regex.Pattern CERT_FOOTER  
      private static java.util.regex.Pattern CERT_HEADER  
      private static java.util.regex.Pattern KEY_FOOTER  
      private static java.util.regex.Pattern KEY_HEADER  
      private static InternalLogger logger  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PemReader()  
    • Field Detail

      • CERT_HEADER

        private static final java.util.regex.Pattern CERT_HEADER
      • CERT_FOOTER

        private static final java.util.regex.Pattern CERT_FOOTER
      • KEY_HEADER

        private static final java.util.regex.Pattern KEY_HEADER
      • KEY_FOOTER

        private static final java.util.regex.Pattern KEY_FOOTER
      • BODY

        private static final java.util.regex.Pattern BODY
    • Constructor Detail

      • PemReader

        private PemReader()
    • Method Detail

      • readCertificates

        static ByteBuf[] readCertificates​(java.io.File file)
                                   throws java.security.cert.CertificateException
        Throws:
        java.security.cert.CertificateException
      • readCertificates

        static ByteBuf[] readCertificates​(java.io.InputStream in)
                                   throws java.security.cert.CertificateException
        Throws:
        java.security.cert.CertificateException
      • readPrivateKey

        static ByteBuf readPrivateKey​(java.io.File file)
                               throws java.security.KeyException
        Throws:
        java.security.KeyException
      • readPrivateKey

        static ByteBuf readPrivateKey​(java.io.InputStream in)
                               throws java.security.KeyException
        Throws:
        java.security.KeyException
      • keyNotFoundException

        private static java.security.KeyException keyNotFoundException()
      • readContent

        private static java.lang.String readContent​(java.io.InputStream in)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • safeClose

        private static void safeClose​(java.io.InputStream in)
      • safeClose

        private static void safeClose​(java.io.OutputStream out)