1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 /*
20  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
21  */
22 /*
23  * $Id: SignedInfo.java 1092655 2011-04-15 10:24:18Z coheigea $
24  */
25 package javax.xml.crypto.dsig;
26 
27 import javax.xml.crypto.XMLStructure;
28 import java.io.InputStream;
29 import java.util.List;
30 
31 /**
32  * An representation of the XML <code>SignedInfo</code> element as
33  * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
34  * W3C Recommendation for XML-Signature Syntax and Processing</a>.
35  * The XML Schema Definition is defined as:
36  * <pre><code>
37  * &lt;element name="SignedInfo" type="ds:SignedInfoType"/&gt;
38  * &lt;complexType name="SignedInfoType"&gt;
39  *   &lt;sequence&gt;
40  *     &lt;element ref="ds:CanonicalizationMethod"/&gt;
41  *     &lt;element ref="ds:SignatureMethod"/&gt;
42  *     &lt;element ref="ds:Reference" maxOccurs="unbounded"/&gt;
43  *   &lt;/sequence&gt;
44  *   &lt;attribute name="Id" type="ID" use="optional"/&gt;
45  * &lt;/complexType&gt;
46  * </code></pre>
47  *
48  * A <code>SignedInfo</code> instance may be created by invoking one of the
49  * {@link XMLSignatureFactory#newSignedInfo newSignedInfo} methods of the
50  * {@link XMLSignatureFactory} class.
51  *
52  * @author Sean Mullan
53  * @author JSR 105 Expert Group
54  * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List)
55  * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List, String)
56  */
57 public interface SignedInfo extends XMLStructure {
58 
59     /**
60      * Returns the canonicalization method of this <code>SignedInfo</code>.
61      *
62      * @return the canonicalization method
63      */
getCanonicalizationMethod()64     CanonicalizationMethod getCanonicalizationMethod();
65 
66     /**
67      * Returns the signature method of this <code>SignedInfo</code>.
68      *
69      * @return the signature method
70      */
getSignatureMethod()71     SignatureMethod getSignatureMethod();
72 
73     /**
74      * Returns an {@link java.util.Collections#unmodifiableList
75      * unmodifiable list} of one or more {@link Reference}s.
76      *
77      * @return an unmodifiable list of one or more {@link Reference}s
78      */
getReferences()79     List getReferences();
80 
81     /**
82      * Returns the optional <code>Id</code> attribute of this
83      * <code>SignedInfo</code>.
84      *
85      * @return the id (may be <code>null</code> if not specified)
86      */
getId()87     String getId();
88 
89     /**
90      * Returns the canonicalized signed info bytes after a signing or
91      * validation operation. This method is useful for debugging.
92      *
93      * @return an <code>InputStream</code> containing the canonicalized bytes,
94      *    or <code>null</code> if this <code>SignedInfo</code> has not been
95      *    signed or validated yet
96      */
getCanonicalizedData()97     InputStream getCanonicalizedData();
98 }
99