0N/A/*
0N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * Copyright 2003-2004 The Apache Software Foundation.
0N/A *
0N/A * Licensed under the Apache License, Version 2.0 (the "License");
0N/A * you may not use this file except in compliance with the License.
0N/A * You may obtain a copy of the License at
0N/A *
0N/A * http://www.apache.org/licenses/LICENSE-2.0
0N/A *
0N/A * Unless required by applicable law or agreed to in writing, software
0N/A * distributed under the License is distributed on an "AS IS" BASIS,
0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A * See the License for the specific language governing permissions and
0N/A * limitations under the License.
0N/A *
0N/A */
0N/Apackage com.sun.org.apache.xml.internal.security.encryption;
0N/A
0N/A
0N/Aimport java.util.Iterator;
0N/Aimport com.sun.org.apache.xml.internal.security.keys.KeyInfo;
0N/Aimport org.w3c.dom.Element;
0N/A
0N/A
0N/A/**
0N/A * A Key Agreement algorithm provides for the derivation of a shared secret key
0N/A * based on a shared secret computed from certain types of compatible public
0N/A * keys from both the sender and the recipient. Information from the originator
0N/A * to determine the secret is indicated by an optional OriginatorKeyInfo
0N/A * parameter child of an <code>AgreementMethod</code> element while that
0N/A * associated with the recipient is indicated by an optional RecipientKeyInfo. A
0N/A * shared key is derived from this shared secret by a method determined by the
0N/A * Key Agreement algorithm.
0N/A * <p>
0N/A * <b>Note:</b> XML Encryption does not provide an on-line key agreement
0N/A * negotiation protocol. The <code>AgreementMethod</code> element can be used by
0N/A * the originator to identify the keys and computational procedure that were
0N/A * used to obtain a shared encryption key. The method used to obtain or select
0N/A * the keys or algorithm used for the agreement computation is beyond the scope
0N/A * of this specification.
0N/A * <p>
0N/A * The <code>AgreementMethod</code> element appears as the content of a
0N/A * <code>ds:KeyInfo</code> since, like other <code>ds:KeyInfo</code> children,
0N/A * it yields a key. This <code>ds:KeyInfo</code> is in turn a child of an
0N/A * <code>EncryptedData</code> or <code>EncryptedKey</code> element. The
0N/A * Algorithm attribute and KeySize child of the <code>EncryptionMethod</code>
0N/A * element under this <code>EncryptedData</code> or <code>EncryptedKey</code>
0N/A * element are implicit parameters to the key agreement computation. In cases
0N/A * where this <code>EncryptionMethod</code> algorithm <code>URI</code> is
0N/A * insufficient to determine the key length, a KeySize MUST have been included.
0N/A * In addition, the sender may place a KA-Nonce element under
0N/A * <code>AgreementMethod</code> to assure that different keying material is
0N/A * generated even for repeated agreements using the same sender and recipient
0N/A * public keys.
0N/A * <p>
0N/A * If the agreed key is being used to wrap a key, then
0N/A * <code>AgreementMethod</code> would appear inside a <code>ds:KeyInfo</code>
0N/A * inside an <code>EncryptedKey</code> element.
0N/A * <p>
0N/A * The Schema for AgreementMethod is as follows:
0N/A * <xmp>
0N/A * <element name="AgreementMethod" type="xenc:AgreementMethodType"/>
0N/A * <complexType name="AgreementMethodType" mixed="true">
0N/A * <sequence>
0N/A * <element name="KA-Nonce" minOccurs="0" type="base64Binary"/>
0N/A * <!-- <element ref="ds:DigestMethod" minOccurs="0"/> -->
0N/A * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
0N/A * <element name="OriginatorKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
0N/A * <element name="RecipientKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
0N/A * </sequence>
0N/A * <attribute name="Algorithm" type="anyURI" use="required"/>
0N/A * </complexType>
0N/A * </xmp>
0N/A *
0N/A * @author Axl Mattheus
0N/A */
0N/Apublic interface AgreementMethod {
0N/A /**
0N/A * Returns an <code>byte</code> array.
0N/A * @return
0N/A */
0N/A byte[] getKANonce();
0N/A
0N/A /**
0N/A * Sets the KANonce.jj
0N/A * @param kanonce
0N/A */
0N/A void setKANonce(byte[] kanonce);
0N/A
0N/A /**
0N/A * Returns aditional information regarding the <code>AgreementMethod</code>.
0N/A * @return
0N/A */
0N/A Iterator getAgreementMethodInformation();
0N/A
0N/A /**
0N/A * Adds additional <code>AgreementMethod</code> information.
0N/A *
0N/A * @param info a <code>Element</code> that represents additional information
0N/A * specified by
0N/A * <xmp>
0N/A * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
0N/A * </xmp>
0N/A */
0N/A void addAgreementMethodInformation(Element info);
0N/A
0N/A /**
0N/A * Removes additional <code>AgreementMethod</code> information.
0N/A *
0N/A * @param info a <code>Element</code> that represents additional information
0N/A * specified by
0N/A * <xmp>
0N/A * <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
0N/A * </xmp>
0N/A */
0N/A void revoveAgreementMethodInformation(Element info);
0N/A
0N/A /**
0N/A * Returns information relating to the originator's shared secret.
0N/A *
0N/A * @return information relating to the originator's shared secret.
0N/A */
0N/A KeyInfo getOriginatorKeyInfo();
0N/A
0N/A /**
0N/A * Sets the information relating to the originator's shared secret.
0N/A *
0N/A * @param keyInfo information relating to the originator's shared secret.
0N/A */
0N/A void setOriginatorKeyInfo(KeyInfo keyInfo);
0N/A
0N/A /**
0N/A * Retruns information relating to the recipient's shared secret.
0N/A *
0N/A * @return information relating to the recipient's shared secret.
0N/A */
0N/A KeyInfo getRecipientKeyInfo();
0N/A
0N/A /**
0N/A * Sets the information relating to the recipient's shared secret.
0N/A *
0N/A * @param keyInfo information relating to the recipient's shared secret.
0N/A */
0N/A void setRecipientKeyInfo(KeyInfo keyInfo);
0N/A
0N/A /**
0N/A * Returns the algorithm URI of this <code>CryptographicMethod</code>.
0N/A *
0N/A * @return the algorithm URI of this <code>CryptographicMethod</code>
0N/A */
0N/A String getAlgorithm();
0N/A}