JDK-8224773 : Add String constants for Canonical XML 1.1 URIs
  • Type: CSR
  • Component: security-libs
  • Sub-Component: javax.xml.crypto
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 13
  • Submitted: 2019-05-24
  • Updated: 2019-05-29
  • Resolved: 2019-05-29
Related Reports
CSR :  
Description
Summary
-------

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

Problem
-------

[Section 6.5.2][1] 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][2] 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.

[1]: https://www.w3.org/TR/xmldsig-core1/#sec-c14nAlg
[2]: https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms
Comments
Moving to Approved.
29-05-2019