@@ -122,6 +122,33 @@ static boolean configure(Properties props) {
122122 }
123123 props .put (fipsProviderKey , fipsProviderValue );
124124 }
125+ // Add other security properties
126+ String keystoreTypeValue = (String ) props .get ("fips.keystore.type" );
127+ if (keystoreTypeValue != null ) {
128+ String nonFipsKeystoreType = props .getProperty ("keystore.type" );
129+ props .put ("keystore.type" , keystoreTypeValue );
130+ if (keystoreTypeValue .equals ("PKCS11" )) {
131+ // If keystore.type is PKCS11, javax.net.ssl.keyStore
132+ // must be "NONE". See JDK-8238264.
133+ System .setProperty ("javax.net.ssl.keyStore" , "NONE" );
134+ }
135+ if (System .getProperty ("javax.net.ssl.trustStoreType" ) == null ) {
136+ // If no trustStoreType has been set, use the
137+ // previous keystore.type under FIPS mode. In
138+ // a default configuration, the Trust Store will
139+ // be 'cacerts' (JKS type).
140+ System .setProperty ("javax.net.ssl.trustStoreType" ,
141+ nonFipsKeystoreType );
142+ }
143+ if (sdebug != null ) {
144+ sdebug .println ("FIPS mode default keystore.type = " +
145+ keystoreTypeValue );
146+ sdebug .println ("FIPS mode javax.net.ssl.keyStore = " +
147+ System .getProperty ("javax.net.ssl.keyStore" , "" ));
148+ sdebug .println ("FIPS mode javax.net.ssl.trustStoreType = " +
149+ System .getProperty ("javax.net.ssl.trustStoreType" , "" ));
150+ }
151+ }
125152 loadedProps = true ;
126153 }
127154 } catch (Exception e ) {
0 commit comments