@@ -282,10 +282,7 @@ public static SSLContext getDefaultContext(boolean readSystemProperties) {
282282 }
283283
284284 /**
285- * Get a new & initialized SSL configurator instance.
286- *
287- * The instance {@link #retrieve(java.util.Properties) retrieves} the initial configuration from
288- * {@link System#getProperties() system properties}.
285+ * Get a new & initialized SSL configurator instance. The the instantiated configurator will be empty.
289286 *
290287 * @return new & initialized SSL configurator instance.
291288 */
@@ -296,9 +293,9 @@ public static SslConfigurator newInstance() {
296293 /**
297294 * Get a new SSL configurator instance.
298295 *
299- * @param readSystemProperties if {@code true}, {@link #retrieve(java.util.Properties ) Retrieves}
300- * the initial configuration from {@link System#getProperties()},
301- * otherwise the instantiated configurator will be empty.
296+ * @param readSystemProperties if {@code true}, {@link #retrieve() Retrieves} the initial configuration from
297+ * {@link System#getProperty(String)}}, otherwise the instantiated configurator will
298+ * be empty.
302299 * @return new SSL configurator instance.
303300 */
304301 public static SslConfigurator newInstance (boolean readSystemProperties ) {
@@ -307,7 +304,7 @@ public static SslConfigurator newInstance(boolean readSystemProperties) {
307304
308305 private SslConfigurator (boolean readSystemProperties ) {
309306 if (readSystemProperties ) {
310- retrieve (AccessController . doPrivileged ( PropertiesHelper . getSystemProperties ()) );
307+ retrieve ();
311308 }
312309 }
313310
@@ -821,6 +818,55 @@ public SslConfigurator retrieve(Properties props) {
821818 return this ;
822819 }
823820
821+ /**
822+ * Retrieve the SSL context configuration from the system properties.
823+ *
824+ * @return updated SSL configurator instance.
825+ */
826+ public SslConfigurator retrieve () {
827+ trustStoreProvider = AccessController .doPrivileged (
828+ PropertiesHelper .getSystemProperty (TRUST_STORE_PROVIDER ));
829+ keyStoreProvider = AccessController .doPrivileged (
830+ PropertiesHelper .getSystemProperty (KEY_STORE_PROVIDER ));
831+
832+ trustManagerFactoryProvider = AccessController .doPrivileged (
833+ PropertiesHelper .getSystemProperty (TRUST_MANAGER_FACTORY_PROVIDER ));
834+ keyManagerFactoryProvider = AccessController .doPrivileged (
835+ PropertiesHelper .getSystemProperty (KEY_MANAGER_FACTORY_PROVIDER ));
836+
837+ trustStoreType = AccessController .doPrivileged (PropertiesHelper .getSystemProperty (TRUST_STORE_TYPE ));
838+ keyStoreType = AccessController .doPrivileged (PropertiesHelper .getSystemProperty (KEY_STORE_TYPE ));
839+
840+ final String trustStorePassword = AccessController .doPrivileged (
841+ PropertiesHelper .getSystemProperty (TRUST_STORE_PASSWORD ));
842+ if (trustStorePassword != null ) {
843+ trustStorePass = trustStorePassword .toCharArray ();
844+ } else {
845+ trustStorePass = null ;
846+ }
847+
848+ final String keyStorePassword = AccessController .doPrivileged (
849+ PropertiesHelper .getSystemProperty (KEY_STORE_PASSWORD ));
850+ if (keyStorePassword != null ) {
851+ keyStorePass = keyStorePassword .toCharArray ();
852+ } else {
853+ keyStorePass = null ;
854+ }
855+
856+ trustStoreFile = AccessController .doPrivileged (PropertiesHelper .getSystemProperty (TRUST_STORE_FILE ));
857+ keyStoreFile = AccessController .doPrivileged (PropertiesHelper .getSystemProperty (KEY_STORE_FILE ));
858+
859+ trustStoreBytes = null ;
860+ keyStoreBytes = null ;
861+
862+ trustStore = null ;
863+ keyStore = null ;
864+
865+ securityProtocol = "TLS" ;
866+
867+ return this ;
868+ }
869+
824870 @ Override
825871 public boolean equals (Object o ) {
826872 if (this == o ) {
0 commit comments