JDK-8187455 : Error loading SunMSCAPI native cryptographic library provider when using java with UNC path
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 8u131
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2017-08-28
  • Updated: 2017-09-12
  • Resolved: 2017-09-12
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 Enterprise, Service Pack 1

A DESCRIPTION OF THE PROBLEM :
When trying to get the list of java.security.Provider using Security.getProviders(), this method does not return all the providers listed in the java.security file.

Provider[] pa = Security.getProviders();

This happens when the program is launched using the network java using UNC path.

For example
\\LW5-NOF-DSA\testshare\jdk1.8.0_131\jre\bin\java -cp D:\users\nof\Work\MySamples\Samples\bin IsSunMSCAPIAvailable

However if the network drive is mapped, it works fine




REGRESSION.  Last worked in version 8u121

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Write a simple java program to get the list of  java.security.Provider using the Security.getProviders()
 OR refer to the sample program provided

2)Run the program using network java using UNC path

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The result of the program should return all the list of providers defined in the java.security file

Provider[] pa = Security.getProviders();
ACTUAL -
Provider[] pa = Security.getProviders() does not return all the providers listed in the java.security file

Observe that the below two are missing from the list of providers returned.
    sun.security.mscapi.SunMSCAPI
    sun.security.ec.SunEC


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Step -1 Use the below sample program to reproduce this issue:
import java.security.*;

public class IsSunMSCAPIAvailable {

    public static void main(String[] args) throws Exception {

		Provider[] pa = Security.getProviders();
		for(Provider pp:pa)
		{
			System.out.println(pp.getName());
		}
    	
        // Check if the provider is available
        try {
            Class.forName("sun.security.mscapi.SunMSCAPI");

        } catch (Exception e) {
            System.out.println(
                "The SunMSCAPI provider is not available on this platform");
            return;
        }

        // Dynamically register the SunMSCAPI provider
        Security.addProvider(new sun.security.mscapi.SunMSCAPI());

        Provider p = Security.getProvider("SunMSCAPI");

        System.out.println("SunMSCAPI provider classname is " +
            p.getClass().getName());
        System.out.println("SunMSCAPI provider name is " + p.getName());
        System.out.println("SunMSCAPI provider version # is " + p.getVersion());
        System.out.println("SunMSCAPI provider info is " + p.getInfo());
     }
}

Step-2:
Launch the program using network java like example below
\\LW5-NOF-DSA\testshare\jdk1.8.0_131\jre\bin\java -cp D:\users\nof\Work\MySamples\Samples\bin IsSunMSCAPIAvailable


---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Map network java instead of using UNC path java


Comments
This looks related to JDK-8181205 and is fixed in JDK 8u152 b05. JDK 8u131- Fail JDK 8u152 b04 - Fail JDK 8u152 b05 - Pass JDK 9-ea+181 - Pass Closing as duplicate of JDK-8181205.
12-09-2017