Class BouncyCastlePemReader


  • final class BouncyCastlePemReader
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.security.PrivateKey getPrivateKey​(java.io.File keyFile, java.lang.String keyPassword)
      Generates a new PrivateKey.
      static java.security.PrivateKey getPrivateKey​(java.io.InputStream keyInputStream, java.lang.String keyPassword)
      Generates a new PrivateKey.
      private static java.security.PrivateKey getPrivateKey​(org.bouncycastle.openssl.PEMParser pemParser, java.lang.String keyPassword)  
      static boolean hasAttemptedLoading()  
      static boolean isAvailable()  
      private static org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter newConverter()  
      private static org.bouncycastle.openssl.PEMParser newParser​(java.io.File keyFile)  
      private static org.bouncycastle.openssl.PEMParser newParser​(java.io.InputStream keyInputStream)  
      private static void tryLoading()  
      static java.lang.Throwable unavailabilityCause()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • unavailabilityCause

        private static volatile java.lang.Throwable unavailabilityCause
      • bcProvider

        private static volatile java.security.Provider bcProvider
      • attemptedLoading

        private static volatile boolean attemptedLoading
    • Constructor Detail

      • BouncyCastlePemReader

        private BouncyCastlePemReader()
    • Method Detail

      • hasAttemptedLoading

        public static boolean hasAttemptedLoading()
      • isAvailable

        public static boolean isAvailable()
      • unavailabilityCause

        public static java.lang.Throwable unavailabilityCause()
        Returns:
        the cause if unavailable. null if available.
      • tryLoading

        private static void tryLoading()
      • getPrivateKey

        public static java.security.PrivateKey getPrivateKey​(java.io.InputStream keyInputStream,
                                                             java.lang.String keyPassword)
        Generates a new PrivateKey.
        Parameters:
        keyInputStream - an input stream for a PKCS#1 or PKCS#8 private key in PEM format.
        keyPassword - the password of the keyFile. null if it's not password-protected.
        Returns:
        generated PrivateKey.
      • getPrivateKey

        public static java.security.PrivateKey getPrivateKey​(java.io.File keyFile,
                                                             java.lang.String keyPassword)
        Generates a new PrivateKey.
        Parameters:
        keyFile - a PKCS#1 or PKCS#8 private key file in PEM format.
        keyPassword - the password of the keyFile. null if it's not password-protected.
        Returns:
        generated PrivateKey.
      • newConverter

        private static org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter newConverter()
      • getPrivateKey

        private static java.security.PrivateKey getPrivateKey​(org.bouncycastle.openssl.PEMParser pemParser,
                                                              java.lang.String keyPassword)
                                                       throws java.io.IOException,
                                                              org.bouncycastle.pkcs.PKCSException,
                                                              org.bouncycastle.operator.OperatorCreationException
        Throws:
        java.io.IOException
        org.bouncycastle.pkcs.PKCSException
        org.bouncycastle.operator.OperatorCreationException
      • newParser

        private static org.bouncycastle.openssl.PEMParser newParser​(java.io.File keyFile)
                                                             throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • newParser

        private static org.bouncycastle.openssl.PEMParser newParser​(java.io.InputStream keyInputStream)