J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | /* |
| 26 | * $Id: SignedInfo.java,v 1.7 2005/05/10 16:03:47 mullan Exp $ |
| 27 | */ |
| 28 | package javax.xml.crypto.dsig; |
| 29 | |
| 30 | import javax.xml.crypto.XMLStructure; |
| 31 | import java.io.InputStream; |
| 32 | import java.util.List; |
| 33 | |
| 34 | /** |
| 35 | * An representation of the XML <code>SignedInfo</code> element as |
| 36 | * defined in the <a href="http://www.w3.org/TR/xmldsig-core/"> |
| 37 | * W3C Recommendation for XML-Signature Syntax and Processing</a>. |
| 38 | * The XML Schema Definition is defined as: |
| 39 | * <pre><code> |
| 40 | * <element name="SignedInfo" type="ds:SignedInfoType"/> |
| 41 | * <complexType name="SignedInfoType"> |
| 42 | * <sequence> |
| 43 | * <element ref="ds:CanonicalizationMethod"/> |
| 44 | * <element ref="ds:SignatureMethod"/> |
| 45 | * <element ref="ds:Reference" maxOccurs="unbounded"/> |
| 46 | * </sequence> |
| 47 | * <attribute name="Id" type="ID" use="optional"/> |
| 48 | * </complexType> |
| 49 | * </code></pre> |
| 50 | * |
| 51 | * A <code>SignedInfo</code> instance may be created by invoking one of the |
| 52 | * {@link XMLSignatureFactory#newSignedInfo newSignedInfo} methods of the |
| 53 | * {@link XMLSignatureFactory} class. |
| 54 | * |
| 55 | * @author Sean Mullan |
| 56 | * @author JSR 105 Expert Group |
| 57 | * @since 1.6 |
| 58 | * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List) |
| 59 | * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List, String) |
| 60 | */ |
| 61 | public interface SignedInfo extends XMLStructure { |
| 62 | |
| 63 | /** |
| 64 | * Returns the canonicalization method of this <code>SignedInfo</code>. |
| 65 | * |
| 66 | * @return the canonicalization method |
| 67 | */ |
| 68 | CanonicalizationMethod getCanonicalizationMethod(); |
| 69 | |
| 70 | /** |
| 71 | * Returns the signature method of this <code>SignedInfo</code>. |
| 72 | * |
| 73 | * @return the signature method |
| 74 | */ |
| 75 | SignatureMethod getSignatureMethod(); |
| 76 | |
| 77 | /** |
| 78 | * Returns an {@link java.util.Collections#unmodifiableList |
| 79 | * unmodifiable list} of one or more {@link Reference}s. |
| 80 | * |
| 81 | * @return an unmodifiable list of one or more {@link Reference}s |
| 82 | */ |
| 83 | List getReferences(); |
| 84 | |
| 85 | /** |
| 86 | * Returns the optional <code>Id</code> attribute of this |
| 87 | * <code>SignedInfo</code>. |
| 88 | * |
| 89 | * @return the id (may be <code>null</code> if not specified) |
| 90 | */ |
| 91 | String getId(); |
| 92 | |
| 93 | /** |
| 94 | * Returns the canonicalized signed info bytes after a signing or |
| 95 | * validation operation. This method is useful for debugging. |
| 96 | * |
| 97 | * @return an <code>InputStream</code> containing the canonicalized bytes, |
| 98 | * or <code>null</code> if this <code>SignedInfo</code> has not been |
| 99 | * signed or validated yet |
| 100 | */ |
| 101 | InputStream getCanonicalizedData(); |
| 102 | } |