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

Add String constants for Canonical XML 1.1 URIs

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 13
    • security-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      Add String constants for the Canonical XML 1.1 URIs to the javax.xml.crypto.dsig.CanonicalizationMethod API.

      Problem

      Section 6.5.2 of the W3C Recommendation for XML Signature 1.1 defines algorithm URIs for Canonical XML 1.1. However, there are no String constants defined in the API, which means that applications must hard-code the URI, as follows, which is not user-friendly and can be error-prone:

      CanonicalizationMethod cm = XMLSignatureFactory.getInstance()
          .newCanonicalizationMethod("http://www.w3.org/2006/12/xml-c14n11", ...);

      The other supported C14N algorithms already have String constants defined in the CanonicalizationMethod API.

      Solution

      1. Add two new String constants for the Canonical XML 1.1 and Canonical XML 1.1 with Comments URIs.
      2. Add these URIs to the XML Signature Transform (TransformService) Algorithms section of the Standard Algorithm Names specification.

      Specification

      javax.xml.crypto.dsig.CanonicalizationMethod:

      /**
       * The <a href="https://www.w3.org/TR/xml-c14n11/">Canonical XML 1.1
       * (without comments)</a> canonicalization method algorithm URI.
       *
       * @since 13
       */
      final static String INCLUSIVE_11 = "http://www.w3.org/2006/12/xml-c14n11";
      
      /**
       * The <a href="https://www.w3.org/TR/xml-c14n11/#WithComments">
       * Canonical XML 1.1 with comments</a> canonicalization method algorithm
       * URI.
       *
       * @since 13
       */
      final static String INCLUSIVE_11_WITH_COMMENTS =
          "http://www.w3.org/2006/12/xml-c14n11#WithComments";

      XML Signature Transform (TransformService) Algorithms section of the Standard Algorithm Names specification:

      Algorithm URI Description
      http://www.w3.org/2006/12/xml-c14n11 (CanonicalizationMethod.INCLUSIVE_11) The Canonical XML 1.1 (without comments) canonicalization algorithm.
      http://www.w3.org/2006/12/xml-c14n11#WithComments (CanonicalizationMethod.INCLUSIVE_11_WITH_COMMENTS) The Canonical XML 1.1 with comments canonicalization algorithm.

            mullan Sean Mullan
            mullan Sean Mullan
            Xuelei Fan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: