Microsoft KB Archive/197944

= FIX: setAllowUserInteraction(true) Fails to Prompt Certificates =

Article ID: 197944

Article Last Modified on 8/25/2005

-

APPLIES TO

 Microsoft Java Virtual Machine, when used with:  Microsoft Windows NT 4.0

 Microsoft Windows 95 

-



This article was previously published under Q197944



SYMPTOMS
Instead of prompting the user for client-side certificates, connection.setAllowUserInteraction(true); (where connection is a URLConnection object) fails. This happens when the Web server is configured so that it requests client certificates.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed for the Microsoft virtual machine build 3154 and greater.



Steps to Reproduce Behavior
<ol> Setup a Web server with both HTTP and HTTPS support (for example, the Web server host name is "XYZ").</li> Get a client certificate from a valid certificate authority.</li> Configure the Web server so that it requests a client certificates, which enables some user interaction on the browser side.</li>  Write the following Java application, HttpGetClient.java: import java.io.*; import java.net.*; import java.applet.*;

public class HttpGetClient extends Applet {  public static void main(String[] args) {      HttpGet(args[0]); }

public void init {      HttpGet(getParameter("URL")); }

public static void HttpGet(String url_s) {       try {          URL url = new URL(url_s); URLConnection connection = url.openConnection; connection.setAllowUserInteraction(true); connection.connect; InputStream in = connection.getInputStream; int  l = connection.getContentLength; if (l < 0) {           l = in.available; }          System.out.println("Content-Length = " + l + "\r\n"); byte[]  buf = new byte[l]; in.read(buf); System.out.println; System.out.println(new String(buf)); }       catch(Throwable e)        { e.printStackTrace; }    }   }                        </li>  Write the following HTML file, HttpGetClient.html: Just testing SSL

<applet code=HttpGetClient.class width=200 height=280> <param name=URL value=https://XYZ/HttpGetClient.html> Just testing SSL </li> Copy the HttpgetClient.java and HttpGetClient.html files into the root directory of the Web server XYZ.</li> Go to the following Web page (browse in a new process):

http://XYZ/HttpGetClient.html

</li></ol>

RESULT: The following error message appears:

java.io.IOException: XYZ:443//HttpGetClient.html

The Java code calls setAllowUserInteraction(true). Therefore, the applet should prompt the user with the client certificate instead of failing.

<div class="references_section">