list fips providers in JDK java.security config file

326 Views Asked by At

My Spring Boot application runs using Java 8 and my JDK8 installation contains a list of security providers property values in the java.security file located in directory ...jdk1.8.0_372\jre\lib\security:

#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=sun.security.ec.SunEC
security.provider.4=com.sun.net.ssl.internal.ssl.Provider
security.provider.5=com.sun.crypto.provider.SunJCE
security.provider.6=sun.security.jgss.SunProvider
security.provider.7=com.sun.security.sasl.Provider
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.9=sun.security.smartcardio.SunPCSC
security.provider.10=sun.security.mscapi.SunMSCAPI

That same java.security file also contains the following list of fips providers:

# Security providers used when FIPS mode support is active
#
fips.provider.1=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.fips.cfg
fips.provider.2=sun.security.provider.Sun
fips.provider.3=sun.security.ec.SunEC
fips.provider.4=com.sun.net.ssl.internal.ssl.Provider SunPKCS11-NSS-FIPS

I want to show each of these in the logs upon application startup. I can do that with code such as the following. But it only shows the providers in the first list (security.provider.), not the second list (fips.provider.):

java.security.Provider[] providers = java.security.Security.getProviders();
for (java.security.Provider provider : providers) {
    System.out.println("Provider: " + provider.getName());
}       

How do I show the ones in the second list?

0

There are 0 best solutions below