Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287246

DSAKeyValue should check for missing params instead of relying on KeyFactory provider

    XMLWordPrintable

Details

    Backports

      Description

        The DSA KeyFactory implementation in the SUN and SunPKCS11 providers handle missing (i.e. null) DSA parameters differently. The SUN provider throws ProviderException if at least one, but not all of the P, Q, and G params are null and the SunPKCS11 provider throws NullPointerException if any are null. Both are similar in that they are treated as RuntimeExceptions which typically indicates an error in the application.

        P, Q, and G are optional according to the XML Signature Recommendation as they might be known from application context, but the JDK implementation does not provide a mechanism or API for an application to supply the missing parameters, so they are required to be specified in the DSAKeyValue element of a KeyInfo element.

        Thus, it seems a more robust fix is to have the XML Signature implementation check for null or missing parameters and throw a MarshalException before trying to create a DSA public key from its XML encoding. This will allow the code to fail earlier and not depend on the provider to detect illegal or missing parameters.

        Attachments

          Issue Links

            Activity

              People

                mullan Sean Mullan
                mullan Sean Mullan
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: