KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > security > encryption > AgreementMethod


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package com.sun.org.apache.xml.internal.security.encryption;
18
19
20 import java.util.Iterator JavaDoc;
21 import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
22 import org.w3c.dom.Element JavaDoc;
23
24
25 /**
26  * A Key Agreement algorithm provides for the derivation of a shared secret key
27  * based on a shared secret computed from certain types of compatible public
28  * keys from both the sender and the recipient. Information from the originator
29  * to determine the secret is indicated by an optional OriginatorKeyInfo
30  * parameter child of an <code>AgreementMethod</code> element while that
31  * associated with the recipient is indicated by an optional RecipientKeyInfo. A
32  * shared key is derived from this shared secret by a method determined by the
33  * Key Agreement algorithm.
34  * <p>
35  * <b>Note:</b> XML Encryption does not provide an on-line key agreement
36  * negotiation protocol. The <code>AgreementMethod</code> element can be used by
37  * the originator to identify the keys and computational procedure that were
38  * used to obtain a shared encryption key. The method used to obtain or select
39  * the keys or algorithm used for the agreement computation is beyond the scope
40  * of this specification.
41  * <p>
42  * The <code>AgreementMethod</code> element appears as the content of a
43  * <code>ds:KeyInfo</code> since, like other <code>ds:KeyInfo</code> children,
44  * it yields a key. This <code>ds:KeyInfo</code> is in turn a child of an
45  * <code>EncryptedData</code> or <code>EncryptedKey</code> element. The
46  * Algorithm attribute and KeySize child of the <code>EncryptionMethod</code>
47  * element under this <code>EncryptedData</code> or <code>EncryptedKey</code>
48  * element are implicit parameters to the key agreement computation. In cases
49  * where this <code>EncryptionMethod</code> algorithm <code>URI</code> is
50  * insufficient to determine the key length, a KeySize MUST have been included.
51  * In addition, the sender may place a KA-Nonce element under
52  * <code>AgreementMethod</code> to assure that different keying material is
53  * generated even for repeated agreements using the same sender and recipient
54  * public keys.
55  * <p>
56  * If the agreed key is being used to wrap a key, then
57  * <code>AgreementMethod</code> would appear inside a <code>ds:KeyInfo</code>
58  * inside an <code>EncryptedKey</code> element.
59  * <p>
60  * The Schema for AgreementMethod is as follows:
61  * <xmp>
62  * <element name="AgreementMethod" type="xenc:AgreementMethodType"/>
63  * <complexType name="AgreementMethodType" mixed="true">
64  * <sequence>
65  * <element name="KA-Nonce" minOccurs="0" type="base64Binary"/>
66  * <!-- <element ref="ds:DigestMethod" minOccurs="0"/> -->
67  * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
68  * <element name="OriginatorKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
69  * <element name="RecipientKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
70  * </sequence>
71  * <attribute name="Algorithm" type="anyURI" use="required"/>
72  * </complexType>
73  * </xmp>
74  *
75  * @author Axl Mattheus
76  */

77 public interface AgreementMethod {
78     /**
79      * Returns an <code>byte</code> array.
80      * @return
81      */

82     byte[] getKANonce();
83
84     /**
85      * Sets the KANonce.jj
86      * @param kanonce
87      */

88     void setKANonce(byte[] kanonce);
89
90     /**
91      * Returns aditional information regarding the <code>AgreementMethod</code>.
92      * @return
93      */

94     Iterator JavaDoc getAgreementMethodInformation();
95
96     /**
97      * Adds additional <code>AgreementMethod</code> information.
98      *
99      * @param info a <code>Element</code> that represents additional information
100      * specified by
101      * <xmp>
102      * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
103      * </xmp>
104      */

105     void addAgreementMethodInformation(Element JavaDoc info);
106
107     /**
108      * Removes additional <code>AgreementMethod</code> information.
109      *
110      * @param info a <code>Element</code> that represents additional information
111      * specified by
112      * <xmp>
113      * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
114      * </xmp>
115      */

116     void revoveAgreementMethodInformation(Element JavaDoc info);
117
118     /**
119      * Returns information relating to the originator's shared secret.
120      *
121      * @return information relating to the originator's shared secret.
122      */

123     KeyInfo getOriginatorKeyInfo();
124
125     /**
126      * Sets the information relating to the originator's shared secret.
127      *
128      * @param keyInfo information relating to the originator's shared secret.
129      */

130     void setOriginatorKeyInfo(KeyInfo keyInfo);
131
132     /**
133      * Retruns information relating to the recipient's shared secret.
134      *
135      * @return information relating to the recipient's shared secret.
136      */

137     KeyInfo getRecipientKeyInfo();
138
139     /**
140      * Sets the information relating to the recipient's shared secret.
141      *
142      * @param keyInfo information relating to the recipient's shared secret.
143      */

144     void setRecipientKeyInfo(KeyInfo keyInfo);
145
146     /**
147      * Returns the algorithm URI of this <code>CryptographicMethod</code>.
148      *
149      * @return the algorithm URI of this <code>CryptographicMethod</code>
150      */

151     String JavaDoc getAlgorithm();
152 }
153
154
Popular Tags