8223053: [xmldsig] Add KeyValue::EC_TYPE
authorweijun
Wed, 29 May 2019 23:36:36 +0800
changeset 55088 69a35cd74f7d
parent 55087 82fe7292ca5c
child 55089 934d68e9c45d
8223053: [xmldsig] Add KeyValue::EC_TYPE Reviewed-by: mullan
src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java	Wed May 22 12:17:26 2019 -0400
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java	Wed May 29 23:36:36 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
 package javax.xml.crypto.dsig.keyinfo;
 
 import java.security.KeyException;
-import java.security.KeyStore;
 import java.security.PublicKey;
 import java.security.interfaces.DSAPublicKey;
 import java.security.interfaces.RSAPublicKey;
@@ -47,6 +46,8 @@
  *      <choice>
  *        <element ref="ds:DSAKeyValue"/>
  *        <element ref="ds:RSAKeyValue"/>
+ *        <!-- <element ref="dsig11:ECKeyValue"/> -->
+ *        <!-- ECC keys (XMLDsig 1.1) will use the any element -->
  *        <any namespace="##other" processContents="lax"/>
  *      </choice>
  *    </complexType>
@@ -75,8 +76,30 @@
  *        <element name="Exponent" type="ds:CryptoBinary"/>
  *      </sequence>
  *    </complexType>
+ *
+ *    <complexType name="ECKeyValueType">
+ *      <sequence>
+ *        <choice>
+ *          <element name="ECParameters" type="dsig11:ECParametersType" />
+ *          <element name="NamedCurve" type="dsig11:NamedCurveType" />
+ *        </choice>
+ *        <element name="PublicKey" type="dsig11:ECPointType" />
+ *      </sequence>
+ *      <attribute name="Id" type="ID" use="optional" />
+ *    </complexType>
+ *
+ *    <complexType name="NamedCurveType">
+ *      <attribute name="URI" type="anyURI" use="required" />
+ *    </complexType>
+ *
+ *    <simpleType name="ECPointType">
+ *      <restriction base="ds:CryptoBinary" />
+ *    </simpleType>
  * </pre>
- * A <code>KeyValue</code> instance may be created by invoking the
+ * See section 4.5.2.3.1 of the W3C Recommendation for the definition
+ * of ECParametersType.
+ *
+ * <p>A <code>KeyValue</code> instance may be created by invoking the
  * {@link KeyInfoFactory#newKeyValue newKeyValue} method of the
  * {@link KeyInfoFactory} class, and passing it a {@link
  * java.security.PublicKey} representing the value of the public key. Here is
@@ -124,6 +147,16 @@
         "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
 
     /**
+     * URI identifying the EC KeyValue KeyInfo type:
+     * http://www.w3.org/2009/xmldsig11#ECKeyValue. This can be specified as
+     * the value of the <code>type</code> parameter of the
+     * {@link RetrievalMethod} class to describe a remote
+     * <code>ECKeyValue</code> structure.
+     */
+    final static String EC_TYPE =
+        "http://www.w3.org/2009/xmldsig11#ECKeyValue";
+
+    /**
      * Returns the public key of this <code>KeyValue</code>.
      *
      * @return the public key of this <code>KeyValue</code>