FIX: setAllowUserInteraction(true) Fails to Prompt Certificates

ID: Q197944


The information in this article applies to:
  • Microsoft virtual machine, on platform(s):
    • Microsoft Windows NT 4.0
    • Windows 95


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.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Setup a Web server with both HTTP and HTTPS support (for example, the Web server host name is "XYZ").


  2. Get a client certificate from a valid certificate authority.


  3. Configure the Web server so that it requests a client certificates, which enables some user interaction on the browser side.


  4. 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();
            }
         }
       } 


  5. Write the following HTML file, HttpGetClient.html:
    
    <html>
    <head>
       <title> Just testing SSL </title>
    </head>
    
    <body>
          <hr>
          <center>
            <applet code=HttpGetClient.class width=200 height=280>
            <param name=URL value=https://XYZ/HttpGetClient.html>
            <h2> Just testing SSL </h2>
            </applet>
          </center>
          <hr>
    </body>
    </html> 


  6. Copy the HttpgetClient.java and HttpGetClient.html files into the root directory of the Web server XYZ.


  7. Go to the following Web page (browse in a new process):
    http://XYZ/HttpGetClient.html


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.


REFERENCES

Please see Internet Client SDK for more information.

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/
(c) Microsoft Corporation <1998>, All Rights Reserved. Contributions by Mohan Ananthakrishnan, Microsoft Corporation.

Additional query words:

Keywords : kbJava kbJavaVM
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.