jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/AgreementMethod.java
author mullan
Mon, 26 Sep 2011 17:20:45 -0700
changeset 10694 cf59e2badd14
parent 2 90ce3da70b43
child 18780 f47b920867e7
permissions -rw-r--r--
7088502: Security libraries don't build with javac -Werror Summary: Changes to files in src/share/classes/com/sun/org/apache/xml/internal/security and its subpackages to remove warnings Reviewed-by: mullan Contributed-by: kurchi.subhra.hazra@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * Copyright  2003-2004 The Apache Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *  Licensed under the Apache License, Version 2.0 (the "License");
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *  you may not use this file except in compliance with the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *  You may obtain a copy of the License at
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *  Unless required by applicable law or agreed to in writing, software
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *  distributed under the License is distributed on an "AS IS" BASIS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *  See the License for the specific language governing permissions and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *  limitations under the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xml.internal.security.encryption;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
import org.w3c.dom.Element;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * A Key Agreement algorithm provides for the derivation of a shared secret key
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * based on a shared secret computed from certain types of compatible public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * keys from both the sender and the recipient. Information from the originator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * to determine the secret is indicated by an optional OriginatorKeyInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * parameter child of an <code>AgreementMethod</code> element while that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * associated with the recipient is indicated by an optional RecipientKeyInfo. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * shared key is derived from this shared secret by a method determined by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Key Agreement algorithm.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <b>Note:</b> XML Encryption does not provide an on-line key agreement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * negotiation protocol. The <code>AgreementMethod</code> element can be used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * the originator to identify the keys and computational procedure that were
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * used to obtain a shared encryption key. The method used to obtain or select
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the keys or algorithm used for the agreement computation is beyond the scope
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * of this specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * The <code>AgreementMethod</code> element appears as the content of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <code>ds:KeyInfo</code> since, like other <code>ds:KeyInfo</code> children,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * it yields a key. This <code>ds:KeyInfo</code> is in turn a child of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <code>EncryptedData</code> or <code>EncryptedKey</code> element. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Algorithm attribute and KeySize child of the <code>EncryptionMethod</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * element under this <code>EncryptedData</code> or <code>EncryptedKey</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * element are implicit parameters to the key agreement computation. In cases
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * where this <code>EncryptionMethod</code> algorithm <code>URI</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * insufficient to determine the key length, a KeySize MUST have been included.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * In addition, the sender may place a KA-Nonce element under
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <code>AgreementMethod</code> to assure that different keying material is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * generated even for repeated agreements using the same sender and recipient
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * public keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * If the agreed key is being used to wrap a key, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <code>AgreementMethod</code> would appear inside a <code>ds:KeyInfo</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * inside an <code>EncryptedKey</code> element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * The Schema for AgreementMethod is as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * <xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * <element name="AgreementMethod" type="xenc:AgreementMethodType"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <complexType name="AgreementMethodType" mixed="true">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *     <sequence>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *         <element name="KA-Nonce" minOccurs="0" type="base64Binary"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *         <!-- <element ref="ds:DigestMethod" minOccurs="0"/> -->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *         <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *         <element name="OriginatorKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *         <element name="RecipientKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *     </sequence>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *     <attribute name="Algorithm" type="anyURI" use="required"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * </complexType>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * </xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * @author Axl Mattheus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
public interface AgreementMethod {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * Returns an <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    byte[] getKANonce();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Sets the KANonce.jj
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @param kanonce
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    void setKANonce(byte[] kanonce);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Returns aditional information regarding the <code>AgreementMethod</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
10694
cf59e2badd14 7088502: Security libraries don't build with javac -Werror
mullan
parents: 2
diff changeset
    98
    Iterator<Element> getAgreementMethodInformation();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Adds additional <code>AgreementMethod</code> information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @param info a <code>Element</code> that represents additional information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * specified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *   <xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *     <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *   </xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    void addAgreementMethodInformation(Element info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Removes additional <code>AgreementMethod</code> information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @param info a <code>Element</code> that represents additional information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * specified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *   <xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *     <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *   </xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    void revoveAgreementMethodInformation(Element info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Returns information relating to the originator's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @return information relating to the originator's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    KeyInfo getOriginatorKeyInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Sets the information relating to the originator's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param keyInfo information relating to the originator's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    void setOriginatorKeyInfo(KeyInfo keyInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * Retruns information relating to the recipient's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @return information relating to the recipient's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    KeyInfo getRecipientKeyInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * Sets the information relating to the recipient's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @param keyInfo information relating to the recipient's shared secret.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    void setRecipientKeyInfo(KeyInfo keyInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * Returns the algorithm URI of this <code>CryptographicMethod</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @return the algorithm URI of this <code>CryptographicMethod</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    String getAlgorithm();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
}