Class FileBasedSslContextFactory

    • Constructor Detail

      • FileBasedSslContextFactory

        public FileBasedSslContextFactory()
      • FileBasedSslContextFactory

        public FileBasedSslContextFactory​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
    • Method Detail

      • shouldReload

        public boolean shouldReload()
        Description copied from interface: ISslContextFactory
        Returns if any changes require the reloading of the SSL context returned by this factory. This will be called by Cassandra's periodic polling for any potential changes that will reload the SSL context. However only newer connections established after the reload will use the reloaded SSL context.
        Returns:
        true if SSL Context needs to be reload; false otherwise
      • hasKeystore

        public boolean hasKeystore()
        Description copied from interface: ISslContextFactory
        Returns if this factory uses private keystore.
        Returns:
        true by default unless the implementation overrides this
      • hasOutboundKeystore

        public boolean hasOutboundKeystore()
        Description copied from interface: ISslContextFactory
        Returns if this factory uses outbound keystore.
        Returns:
        true by default unless the implementation overrides this
      • initHotReloading

        public void initHotReloading()
        Description copied from interface: ISslContextFactory
        Initializes hot reloading of the security keys/certs. The implementation must guarantee this to be thread safe.
      • validatePassword

        protected void validatePassword​(boolean isOutboundKeystore,
                                        java.lang.String password)
        Validates the given keystore password.
        Parameters:
        isOutboundKeystore - true for the outbound_keystore_password;false otherwise
        password - value
        Throws:
        java.lang.IllegalArgumentException - if the password is null
      • buildKeyManagerFactory

        protected javax.net.ssl.KeyManagerFactory buildKeyManagerFactory()
                                                                  throws javax.net.ssl.SSLException
        Builds required KeyManagerFactory from the file based keystore. It also checks for the PrivateKey's certificate's expiry and logs warning for each expired PrivateKey's certitificate.
        Specified by:
        buildKeyManagerFactory in class AbstractSslContextFactory
        Returns:
        KeyManagerFactory built from the file based keystore.
        Throws:
        javax.net.ssl.SSLException - if any issues encountered during the build process
        java.lang.IllegalArgumentException - if the validation for the keystore_password fails
        See Also:
        validatePassword(boolean, String)
      • buildOutboundKeyManagerFactory

        protected javax.net.ssl.KeyManagerFactory buildOutboundKeyManagerFactory()
                                                                          throws javax.net.ssl.SSLException
        Description copied from class: AbstractSslContextFactory
        Create a KeyManagerFactory for outbound connections. It provides a seperate keystore for internode mTLS outbound connections.
        Specified by:
        buildOutboundKeyManagerFactory in class AbstractSslContextFactory
        Returns:
        KeyManagerFactory
        Throws:
        javax.net.ssl.SSLException
      • buildTrustManagerFactory

        protected javax.net.ssl.TrustManagerFactory buildTrustManagerFactory()
                                                                      throws javax.net.ssl.SSLException
        Builds TrustManagerFactory from the file based truststore.
        Specified by:
        buildTrustManagerFactory in class AbstractSslContextFactory
        Returns:
        TrustManagerFactory from the file based truststore
        Throws:
        javax.net.ssl.SSLException - if any issues encountered during the build process
      • checkExpiredCerts

        protected boolean checkExpiredCerts​(java.security.KeyStore ks)
                                     throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException