From 71825293eb83d7c9ac122c11a12465c2acbec040 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 29 May 2019 23:36:36 +0800 Subject: [PATCH] 8223053: [xmldsig] Add KeyValue::EC_TYPE Reviewed-by: mullan --- .../xml/crypto/dsig/keyinfo/KeyValue.java | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java index 36bda001f88..175f7d6b6ec 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyValue.java @@ -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 @@ import javax.xml.crypto.XMLStructure; * <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 @@ import javax.xml.crypto.XMLStructure; * <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> * - * A KeyValue instance may be created by invoking the + * See section 4.5.2.3.1 of the W3C Recommendation for the definition + * of ECParametersType. + * + *

A KeyValue 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 @@ -123,6 +146,16 @@ public interface KeyValue extends XMLStructure { final static String RSA_TYPE = "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 type parameter of the + * {@link RetrievalMethod} class to describe a remote + * ECKeyValue structure. + */ + final static String EC_TYPE = + "http://www.w3.org/2009/xmldsig11#ECKeyValue"; + /** * Returns the public key of this KeyValue. *