History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/javax/xml/crypto/dsig/Reference.java (1 of 18352 files). Show all

Unified · Split

java/pkg/javax/xml/crypto/dsig/Reference.java+168−0
@@ -0,0 +1,168 @@
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: Reference.java,v 1.9 2005/05/10 16:03:46 mullan Exp $
27+ */
28+package javax.xml.crypto.dsig;
29+
30+import javax.xml.crypto.Data;
31+import javax.xml.crypto.URIReference;
32+import javax.xml.crypto.XMLStructure;
33+import java.io.InputStream;
34+import java.util.List;
35+
36+/**
37+ * A representation of the <code>Reference</code> element as defined in the
38+ * <a href="http://www.w3.org/TR/xmldsig-core/">
39+ * W3C Recommendation for XML-Signature Syntax and Processing</a>.
40+ * The XML schema is defined as:
41+ * <code><pre>
42+ * &lt;element name="Reference" type="ds:ReferenceType"/&gt;
43+ * &lt;complexType name="ReferenceType"&gt;
44+ * &lt;sequence&gt;
45+ * &lt;element ref="ds:Transforms" minOccurs="0"/&gt;
46+ * &lt;element ref="ds:DigestMethod"/&gt;
47+ * &lt;element ref="ds:DigestValue"/&gt;
48+ * &lt;/sequence&gt;
49+ * &lt;attribute name="Id" type="ID" use="optional"/&gt;
50+ * &lt;attribute name="URI" type="anyURI" use="optional"/&gt;
51+ * &lt;attribute name="Type" type="anyURI" use="optional"/&gt;
52+ * &lt;/complexType&gt;
53+ *
54+ * &lt;element name="DigestValue" type="ds:DigestValueType"/&gt;
55+ * &lt;simpleType name="DigestValueType"&gt;
56+ * &lt;restriction base="base64Binary"/&gt;
57+ * &lt;/simpleType&gt;
58+ * </pre></code>
59+ *
60+ * <p>A <code>Reference</code> instance may be created by invoking one of the
61+ * {@link XMLSignatureFactory#newReference newReference} methods of the
62+ * {@link XMLSignatureFactory} class; for example:
63+ *
64+ * <pre>
65+ * XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
66+ * Reference ref = factory.newReference
67+ * ("http://www.ietf.org/rfc/rfc3275.txt",
68+ * factory.newDigestMethod(DigestMethod.SHA1, null));
69+ * </pre>
70+ *
71+ * @author Sean Mullan
72+ * @author Erwin van der Koogh
73+ * @author JSR 105 Expert Group
74+ * @since 1.6
75+ * @see XMLSignatureFactory#newReference(String, DigestMethod)
76+ * @see XMLSignatureFactory#newReference(String, DigestMethod, List, String, String)
77+ */
78+public interface Reference extends URIReference, XMLStructure {
79+
80+ /**
81+ * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
82+ * list} of {@link Transform}s that are contained in this
83+ * <code>Reference</code>.
84+ *
85+ * @return an unmodifiable list of <code>Transform</code>s
86+ * (may be empty but never <code>null</code>)
87+ */
88+ List getTransforms();
89+
90+ /**
91+ * Returns the digest method of this <code>Reference</code>.
92+ *
93+ * @return the digest method
94+ */
95+ DigestMethod getDigestMethod();
96+
97+ /**
98+ * Returns the optional <code>Id</code> attribute of this
99+ * <code>Reference</code>, which permits this reference to be
100+ * referenced from elsewhere.
101+ *
102+ * @return the <code>Id</code> attribute (may be <code>null</code> if not
103+ * specified)
104+ */
105+ String getId();
106+
107+ /**
108+ * Returns the digest value of this <code>Reference</code>.
109+ *
110+ * @return the raw digest value, or <code>null</code> if this reference has
111+ * not been digested yet. Each invocation of this method returns a new
112+ * clone to protect against subsequent modification.
113+ */
114+ byte[] getDigestValue();
115+
116+ /**
117+ * Returns the calculated digest value of this <code>Reference</code>
118+ * after a validation operation. This method is useful for debugging if
119+ * the reference fails to validate.
120+ *
121+ * @return the calculated digest value, or <code>null</code> if this
122+ * reference has not been validated yet. Each invocation of this method
123+ * returns a new clone to protect against subsequent modification.
124+ */
125+ byte[] getCalculatedDigestValue();
126+
127+ /**
128+ * Validates this reference. This method verifies the digest of this
129+ * reference.
130+ *
131+ * <p>This method only validates the reference the first time it is
132+ * invoked. On subsequent invocations, it returns a cached result.
133+ *
134+ * @return <code>true</code> if this reference was validated successfully;
135+ * <code>false</code> otherwise
136+ * @param validateContext the validating context
137+ * @throws NullPointerException if <code>validateContext</code> is
138+ * <code>null</code>
139+ * @throws XMLSignatureException if an unexpected exception occurs while
140+ * validating the reference
141+ */
142+ boolean validate(XMLValidateContext validateContext)
143+ throws XMLSignatureException;
144+
145+ /**
146+ * Returns the dereferenced data, if
147+ * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
148+ * is enabled. This is the result of dereferencing the URI of this
149+ * reference during a validation or generation operation.
150+ *
151+ * @return the dereferenced data, or <code>null</code> if reference
152+ * caching is not enabled or this reference has not been generated or
153+ * validated
154+ */
155+ Data getDereferencedData();
156+
157+ /**
158+ * Returns the pre-digested input stream, if
159+ * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
160+ * is enabled. This is the input to the digest operation during a
161+ * validation or signing operation.
162+ *
163+ * @return an input stream containing the pre-digested input, or
164+ * <code>null</code> if reference caching is not enabled or this
165+ * reference has not been generated or validated
166+ */
167+ InputStream getDigestInputStream();
168+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t