Class TlsUtil


  • public final class TlsUtil
    extends java.lang.Object
    Utilities for working with TLS.

    This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TlsUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static byte[] decodePem​(byte[] pem)  
      (package private) static java.security.PrivateKey generatePrivateKey​(java.security.spec.PKCS8EncodedKeySpec keySpec, java.util.List<java.security.KeyFactory> keyFactories)  
      static javax.net.ssl.X509KeyManager keyManager​(byte[] privateKeyPem, byte[] certificatePem)
      Creates KeyManager initiated by keystore containing single private key with matching certificate chain.
      static javax.net.ssl.X509TrustManager trustManager​(byte[] trustedCertificatesPem)
      Returns a TrustManager for the given trusted certificates.
      • Methods inherited from class java.lang.Object

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

      • SUPPORTED_KEY_FACTORIES

        private static final java.util.List<java.security.KeyFactory> SUPPORTED_KEY_FACTORIES
    • Constructor Detail

      • TlsUtil

        private TlsUtil()
    • Method Detail

      • keyManager

        public static javax.net.ssl.X509KeyManager keyManager​(byte[] privateKeyPem,
                                                              byte[] certificatePem)
                                                       throws javax.net.ssl.SSLException
        Creates KeyManager initiated by keystore containing single private key with matching certificate chain.
        Throws:
        javax.net.ssl.SSLException
      • generatePrivateKey

        static java.security.PrivateKey generatePrivateKey​(java.security.spec.PKCS8EncodedKeySpec keySpec,
                                                           java.util.List<java.security.KeyFactory> keyFactories)
                                                    throws javax.net.ssl.SSLException
        Throws:
        javax.net.ssl.SSLException
      • trustManager

        public static javax.net.ssl.X509TrustManager trustManager​(byte[] trustedCertificatesPem)
                                                           throws javax.net.ssl.SSLException
        Returns a TrustManager for the given trusted certificates.
        Throws:
        javax.net.ssl.SSLException
      • decodePem

        static byte[] decodePem​(byte[] pem)