Showing posts with label Internet Explorer. Show all posts
Showing posts with label Internet Explorer. Show all posts

Thursday, August 04, 2016

How to Generate an SHA-2 (SHA-256) Self-Signed Certificate in Java

I was working on a couple of SSL based issues when I made a couple of observations. The default self-signed key generation in Java does not meet today's requirements for web development.

SHA-1 based certificates (default) are no longer going to be accepted by the majority of browsers. Microsoft has set a deadline of February 2014, Mozilla,  and Chrome on 1 January 2017.

Additionally, a key size of less than 2048 is considered insecure as well, so we need to make sure the key size is at least 2048.

So how do you generate a SHA-2 (SHA-256) certificate in Java? Here is an example below.
keytool -genkey -alias example -keyalg RSA -sigalg SHA256withRSA -keysize 2048 -validity 3650 -keystore keystore.jks
In this example we create a certificate with validity of 10 years. The -sigalg SHA256withRSA is used to set it to SHA-256.

Tuesday, January 08, 2013

Internet Explorer 9 (IE9) Table White Space Issues

I was tasked with fixing a problem in our product where one of our data tables (HTML) was rendering on IE9 with spaces randomly scattered throughout the table this resulted in the data being in the wrong columns, or headers appearing in the wrong place. I originally thought I might there might be "holes", or null values in my data which was resulting in the error. I was wrong.

It is actually a bug in IE9.

The issue shows up, most often, when using AJAX when there is partial page rendering. It seems according to forum remarks to be focused on white space between table tag elements like line breaks, spaces, or carriage returns. So if you use HTML tidy, you will screw up your output. Nice one Microsoft!

Fortunately, there are "fixes" out there to help you get along. Here is the fix which I slightly modified from an answer on stackoverflow. A shout out goes to Blago for his recursive function listed below.

You can implement it this way.
Here are some references on the issue if you are interested.

Wednesday, December 28, 2011

Multiple File Upload Examples

I received an email today from a developer who was looking for examples of how to do multiple file uploads. I had written a post previously Multiple File Upload Options which detailed some of the options available. The option I recommended was Andrew Valums ajax-upload. The developer had indicated that the servlet I contributed was not working with Internet Explorer correctly. He was correct.

The code that I provided to Andrew Vallums was expecting application/octet-stream. However Internet Explorer and Opera were sending multipart/form-data. This would not work with the servlet example I posted since the handling mechanism is considerably different.

Alan O'Driscoll and I discovered the differences using Wireshark to sniff the packets and see what was being sent over the wire. As a result, I have written a new servlet to handle the differences between browsers.

The example application I wrote has a number of different examples included with minor variations on the theme. The version most folks are interested in is example #6 which uses the ajax-upload, and the new servlet. Here is the Apache Maven project which was developed on NetBeans and tested on GlassFish v 2.1.1.

Here is a link to the Mercurial project: apache-file-upload-ee5.

Here is another resource for file upload plugins: 9 Powerful jQuery File Upload Plugins. I discovered it while I was looking for something else.

MultiContentServlet.java


Monday, June 06, 2011

Internet Explorer 8 and XHTML Comments

Never Internet ExplorerImage via Wikipedia
Yesterday, I posted a JSF 1.2 login example using nearly pure JSF. I discovered the answer to a bug which was not documented anywhere that I can find. The issue has to do with comments. Internet Explorer 8 seems to choke on them. When I created the example yesterday, I tested it extensively on a number of modern browsers that I have available to me. It works perfectly as expected... with one exception. The other browsers treat the <-- COMMENT --> perfectly. Internet Explorer can not seem to digest it. There is likely some reason (READ EXCUSE) for this behavior, but I can not seem to fathom it. The result on the login page is to cause the browser to spin until timeout, and then re-render the previous page.

This error seems to not care if the DOCTYPE is declared before, or after the comment. I checked just in case.

OK...So I found a bug, but how do you fix it. Well, it is really easy.
  1. Remove all the comments from the page. This is bad for obvious reasons.
  2. If you are using facelets, we have two methods available depending on the version of JSF you are using.
    • JSF 1.2 - Add this context parameter to the web.xml
      <context-param>
              <description>
                  If comments are enabled, the copyright header will prevent the login form
                  from working on Internet Explorer. Alternatively, you can remove the copyright
                  header.
              </description>
              <param-name>facelets.SKIP_COMMENTS</param-name>
              <param-value>true</param-value>
          </context-param>
      
    • JSF 2.x - Add this context parameter to the web.xml
      <context-param>
              <description>
                  If comments are enabled, the copyright header will prevent the login form
                  from working on Internet Explorer. Alternatively, you can remove the copyright
                  header.
              </description>
              <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
              <param-value>true</param-value>
          </context-param>
      

Once you disable the comments, the login page works perfectly. The comments also apparently cause issues with rendering RichFaces pages which now work without issue, or compatibility mode hacks.
Enhanced by Zemanta

Popular Posts