1 /* 2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 /* 26 * $Id: X509Data.java,v 1.4 2005/05/10 16:35:35 mullan Exp $ 27 */ 28 package javax.xml.crypto.dsig.keyinfo; 29 30 import javax.xml.crypto.XMLStructure; 31 import java.security.cert.X509CRL; 32 import java.util.List; 33 34 /** 35 * A representation of the XML <code>X509Data</code> element as defined in 36 * the <a href="http://www.w3.org/TR/xmldsig-core/"> 37 * W3C Recommendation for XML-Signature Syntax and Processing</a>. An 38 * <code>X509Data</code> object contains one or more identifers of keys 39 * or X.509 certificates (or certificates' identifiers or a revocation list). 40 * The XML Schema Definition is defined as: 41 * 42 * <pre> 43 * <element name="X509Data" type="ds:X509DataType"/> 44 * <complexType name="X509DataType"> 45 * <sequence maxOccurs="unbounded"> 46 * <choice> 47 * <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/> 48 * <element name="X509SKI" type="base64Binary"/> 49 * <element name="X509SubjectName" type="string"/> 50 * <element name="X509Certificate" type="base64Binary"/> 51 * <element name="X509CRL" type="base64Binary"/> 52 * <any namespace="##other" processContents="lax"/> 53 * </choice> 54 * </sequence> 55 * </complexType> 56 * 57 * <complexType name="X509IssuerSerialType"> 58 * <sequence> 59 * <element name="X509IssuerName" type="string"/> 60 * <element name="X509SerialNumber" type="integer"/> 61 * </sequence> 62 * </complexType> 63 * </pre> 64 * 65 * An <code>X509Data</code> instance may be created by invoking the 66 * {@link KeyInfoFactory#newX509Data newX509Data} methods of the 67 * {@link KeyInfoFactory} class and passing it a list of one or more 68 * {@link XMLStructure}s representing X.509 content; for example: 69 * <pre> 70 * KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM"); 71 * X509Data x509Data = factory.newX509Data 72 * (Collections.singletonList("cn=Alice")); 73 * </pre> 74 * 75 * @author Sean Mullan 76 * @author JSR 105 Expert Group 77 * @since 1.6 78 * @see KeyInfoFactory#newX509Data(List) 79 */ 80 //@@@ check for illegal combinations of data violating MUSTs in W3c spec 81 public interface X509Data extends XMLStructure { 82 83 /** 84 * URI identifying the X509Data KeyInfo type: 85 * http://www.w3.org/2000/09/xmldsig#X509Data. This can be specified as 86 * the value of the <code>type</code> parameter of the 87 * {@link RetrievalMethod} class to describe a remote 88 * <code>X509Data</code> structure. 89 */ 90 final static String TYPE = "http://www.w3.org/2000/09/xmldsig#X509Data"; 91 92 /** 93 * URI identifying the binary (ASN.1 DER) X.509 Certificate KeyInfo type: 94 * http://www.w3.org/2000/09/xmldsig#rawX509Certificate. This can be 95 * specified as the value of the <code>type</code> parameter of the 96 * {@link RetrievalMethod} class to describe a remote X509 Certificate. 97 */ 98 final static String RAW_X509_CERTIFICATE_TYPE = 99 "http://www.w3.org/2000/09/xmldsig#rawX509Certificate"; 100 101 /** 102 * Returns an {@link java.util.Collections#unmodifiableList unmodifiable 103 * list} of the content in this <code>X509Data</code>. Valid types are 104 * {@link String} (subject names), <code>byte[]</code> (subject key ids), 105 * {@link java.security.cert.X509Certificate}, {@link X509CRL}, 106 * or {@link XMLStructure} ({@link X509IssuerSerial} 107 * objects or elements from an external namespace). 108 * 109 * @return an unmodifiable list of the content in this <code>X509Data</code> 110 * (never <code>null</code> or empty) 111 */ 112 List getContent(); 113 }