Ich habe mehrere Programme, die SunMSCAPI
verwenden, um Webseiten zu lesen, die ein SSL-Zertifikat erfordern. Mein Code funktioniert unter Windows XP (32 Bit), funktioniert aber nicht unter meiner Neuinstallation von Windows 7 (64 Bit). Hier ist das Stück Code:java.security.NoSuchProviderException: kein solcher Provider: SunMSCAPI
System.setProperty("javax.net.ssl.keyStoreProvider", "SunMSCAPI");
System.setProperty("javax.net.ssl.keyStoreType", "WINDOWS-MY");
System.setProperty("javax.net.ssl.trustStoreProvider", "SunMSCAPI");
System.setProperty("javax.net.ssl.trustStoreType", "WINDOWS-ROOT");
System.setProperty("proxyHost", "proxy");
System.setProperty("proxyPort", "8080");
URL url = new URL(TEST_URL);
try {
HttpsURLConnection httpsCon = (HttpsURLConnection) url.openConnection();....
Und hier wird der Stack-Trace:
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at javax.net.ssl.SSLContext.getInstance(Unknown Source)
at javax.net.ssl.SSLContext.getDefault(Unknown Source)
at javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source)
at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(Unknown Source)
at javax.net.ssl.HttpsURLConnection.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(Unknown Source)
at sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at java.net.URL.openConnection(Unknown Source)
at GetData2.SetVallues(GetData2.java:56) *// HttpsURLConnection httpsCon = (HttpsURLConnection) url.openConnection();*
... 2 more
Caused by: java.security.NoSuchProviderException: no such provider: SunMSCAPI
at sun.security.jca.GetInstance.getService(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Security.getImpl(Unknown Source)
at java.security.KeyStore.getInstance(Unknown Source)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(Unknown Source)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 15 more
Ich habe versucht auch folgende Beispiel http://muhammadhamed.blogspot.com/2010/04/accessing-ms-certificate-stores-in-java.html aber wieder dieses NoSuchProviderException
erhalten. Meine Vermutung ist, dass es einige Konfigurationsfehler gibt, aber ich bin mir nicht sicher, was es ist.
Hier ist meine JVM Informationen:
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
ich jemanden hoffe der Lage sein wird, mir zu helfen :-)
Mit freundlichen Grüßen.
hah. 10x alles funktioniert mit 32b Java – npocmaka