/** * Returns the {@link OpenSslKeyMaterialProvider} that should be used for OpenSSL. Depending on the given * {@link KeyManagerFactory} this may cache the {@link OpenSslKeyMaterial} for better performance if it can * ensure that the same material is always returned for the same alias. */ static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); } }
/** * Returns the {@link OpenSslKeyMaterialProvider} that should be used for OpenSSL. Depending on the given * {@link KeyManagerFactory} this may cache the {@link OpenSslKeyMaterial} for better performance if it can * ensure that the same material is always returned for the same alias. */ static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); } }
/** * Returns the {@link OpenSslKeyMaterialProvider} that should be used for OpenSSL. Depending on the given * {@link KeyManagerFactory} this may cache the {@link OpenSslKeyMaterial} for better performance if it can * ensure that the same material is always returned for the same alias. */ static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); } }
/** * Returns the {@link OpenSslKeyMaterialProvider} that should be used for OpenSSL. Depending on the given * {@link KeyManagerFactory} this may cache the {@link OpenSslKeyMaterial} for better performance if it can * ensure that the same material is always returned for the same alias. */ static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); } }