jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java
author wetmore
Tue, 20 Jun 2017 12:57:42 -0700
changeset 45665 6f21cd7ec80e
parent 27747 3a271dc8b758
permissions -rw-r--r--
8178114: Fix guide links in security APIs Reviewed-by: xuelei, mullan, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
27747
3a271dc8b758 8046949: Generify the javax.xml.crypto API
mullan
parents: 25859
diff changeset
     2
 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * ===========================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * (C) Copyright IBM Corp. 2003 All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * ===========================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * $Id: XMLSignature.java,v 1.10 2005/05/10 16:03:48 mullan Exp $
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
package javax.xml.crypto.dsig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.xml.crypto.KeySelector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.xml.crypto.KeySelectorResult;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.xml.crypto.MarshalException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import javax.xml.crypto.XMLStructure;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.xml.crypto.dsig.keyinfo.KeyInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.security.Signature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * A representation of the XML <code>Signature</code> element as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * W3C Recommendation for XML-Signature Syntax and Processing</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * This class contains methods for signing and validating XML signatures
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * with behavior as defined by the W3C specification. The XML Schema Definition
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * is defined as:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <pre><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * &lt;element name="Signature" type="ds:SignatureType"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * &lt;complexType name="SignatureType"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *    &lt;sequence&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *      &lt;element ref="ds:SignedInfo"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *      &lt;element ref="ds:SignatureValue"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *      &lt;element ref="ds:KeyInfo" minOccurs="0"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *      &lt;element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *    &lt;/sequence&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *    &lt;attribute name="Id" type="ID" use="optional"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * &lt;/complexType&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * </code></pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * An <code>XMLSignature</code> instance may be created by invoking one of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * {@link XMLSignatureFactory#newXMLSignature newXMLSignature} methods of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * {@link XMLSignatureFactory} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <p>If the contents of the underlying document containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * <code>XMLSignature</code> are subsequently modified, the behavior is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * <p>Note that this class is named <code>XMLSignature</code> rather than
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * <code>Signature</code> to avoid naming clashes with the existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * {@link Signature java.security.Signature} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * @see XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * @see XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo, List, String, String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * @author Joyce L. Leung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * @author Erwin van der Koogh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * @author JSR 105 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
public interface XMLSignature extends XMLStructure {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * The XML Namespace URI of the W3C Recommendation for XML-Signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Syntax and Processing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    final static String XMLNS = "http://www.w3.org/2000/09/xmldsig#";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Validates the signature according to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * <a href="http://www.w3.org/TR/xmldsig-core/#sec-CoreValidation">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * core validation processing rules</a>. This method validates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * signature using the existing state, it does not unmarshal and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * reinitialize the contents of the <code>XMLSignature</code> using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * location information specified in the context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>This method only validates the signature the first time it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * invoked. On subsequent invocations, it returns a cached result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param validateContext the validating context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @return <code>true</code> if the signature passed core validation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *    otherwise <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @throws ClassCastException if the type of <code>validateContext</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *    is not compatible with this <code>XMLSignature</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @throws NullPointerException if <code>validateContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *    <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @throws XMLSignatureException if an unexpected error occurs during
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *    validation that prevented the validation operation from completing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    boolean validate(XMLValidateContext validateContext)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        throws XMLSignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Returns the key info of this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @return the key info (may be <code>null</code> if not specified)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    KeyInfo getKeyInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Returns the signed info of this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @return the signed info (never <code>null</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    SignedInfo getSignedInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * list} of {@link XMLObject}s contained in this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @return an unmodifiable list of <code>XMLObject</code>s (may be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *    but never <code>null</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
27747
3a271dc8b758 8046949: Generify the javax.xml.crypto API
mullan
parents: 25859
diff changeset
   139
    List<XMLObject> getObjects();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Returns the optional Id of this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @return the Id (may be <code>null</code> if not specified)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    String getId();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Returns the signature value of this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @return the signature value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    SignatureValue getSignatureValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * Signs this <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * <p>If this method throws an exception, this <code>XMLSignature</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * the <code>signContext</code> parameter will be left in the state that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * it was in prior to the invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @param signContext the signing context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @throws ClassCastException if the type of <code>signContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *    not compatible with this <code>XMLSignature</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @throws NullPointerException if <code>signContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *    <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @throws MarshalException if an exception occurs while marshalling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @throws XMLSignatureException if an unexpected exception occurs while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *    generating the signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    void sign(XMLSignContext signContext) throws MarshalException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        XMLSignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Returns the result of the {@link KeySelector}, if specified, after
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * this <code>XMLSignature</code> has been signed or validated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @return the key selector result, or <code>null</code> if a key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *    selector has not been specified or this <code>XMLSignature</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *    has not been signed or validated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    KeySelectorResult getKeySelectorResult();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * A representation of the XML <code>SignatureValue</code> element as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * W3C Recommendation for XML-Signature Syntax and Processing</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * The XML Schema Definition is defined as:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *   &lt;element name="SignatureValue" type="ds:SignatureValueType"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *     &lt;complexType name="SignatureValueType"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *       &lt;simpleContent&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *         &lt;extension base="base64Binary"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *           &lt;attribute name="Id" type="ID" use="optional"/&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *         &lt;/extension&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *       &lt;/simpleContent&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *     &lt;/complexType&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @author JSR 105 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public interface SignatureValue extends XMLStructure {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
         * Returns the optional <code>Id</code> attribute of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
         * <code>SignatureValue</code>, which permits this element to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
         * referenced from elsewhere.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
         * @return the <code>Id</code> attribute (may be <code>null</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
         *    not specified)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        String getId();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
         * Returns the signature value of this <code>SignatureValue</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
         * @return the signature value (may be <code>null</code> if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
         *    <code>XMLSignature</code> has not been signed yet). Each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
         *    invocation of this method returns a new clone of the array to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
         *    prevent subsequent modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        byte[] getValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
         * Validates the signature value. This method performs a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
         * cryptographic validation of the signature calculated over the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
         * <code>SignedInfo</code> of the <code>XMLSignature</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
         * <p>This method only validates the signature the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
         * time it is invoked. On subsequent invocations, it returns a cached
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
         * result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
         * @return <code>true</code> if the signature was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
         *    validated successfully; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
         * @param validateContext the validating context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         * @throws NullPointerException if <code>validateContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
         *    <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
         * @throws XMLSignatureException if an unexpected exception occurs while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
         *    validating the signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        boolean validate(XMLValidateContext validateContext)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            throws XMLSignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}