KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.sun.org.apache.xml.internal.security.keys.KeyInfo;
21
22
23 /**
24  * EncryptedType is the abstract type from which <code>EncryptedData</code> and
25  * <code>EncryptedKey</code> are derived. While these two latter element types
26  * are very similar with respect to their content models, a syntactical
27  * distinction is useful to processing.
28  * <p>
29  * Its schema definition is as follows:
30  * <xmp>
31  * <complexType name='EncryptedType' abstract='true'>
32  * <sequence>
33  * <element name='EncryptionMethod' type='xenc:EncryptionMethodType'
34  * minOccurs='0'/>
35  * <element ref='ds:KeyInfo' minOccurs='0'/>
36  * <element ref='xenc:CipherData'/>
37  * <element ref='xenc:EncryptionProperties' minOccurs='0'/>
38  * </sequence>
39  * <attribute name='Id' type='ID' use='optional'/>
40  * <attribute name='Type' type='anyURI' use='optional'/>
41  * <attribute name='MimeType' type='string' use='optional'/>
42  * <attribute name='Encoding' type='anyURI' use='optional'/>
43  * </complexType>
44  * </xmp>
45  *
46  * @author Axl Mattheus
47  */

48 public interface EncryptedType {
49     /**
50      * Returns a <code>String</code> providing for the standard method of
51      * assigning an id to the element within the document context.
52      *
53      * @return the id for the <code>EncryptedType</code>.
54      */

55     String JavaDoc getId();
56
57     /**
58      * Sets the id.
59      *
60      * @param id.
61      */

62     void setId(String JavaDoc id);
63
64     /**
65      * Returns an <code>URI</code> identifying type information about the
66      * plaintext form of the encrypted content. While optional, this
67      * specification takes advantage of it for mandatory processing described in
68      * Processing Rules: Decryption (section 4.2). If the
69      * <code>EncryptedData</code> element contains data of Type 'element' or
70      * element 'content', and replaces that data in an XML document context, it
71      * is strongly recommended the Type attribute be provided. Without this
72      * information, the decryptor will be unable to automatically restore the
73      * XML document to its original cleartext form.
74      *
75      * @return the identifier for the type of information in plaintext form of
76      * encrypted content.
77      */

78     String JavaDoc getType();
79
80     /**
81      * Sets the type.
82      *
83      * @param type an <code>URI</code> identifying type information about the
84      * plaintext form of the encrypted content.
85      */

86     void setType(String JavaDoc type);
87
88     /**
89      * Returns a <code>String</code> which describes the media type of the data
90      * which has been encrypted. The value of this attribute has values defined
91      * by [MIME]. For example, if the data that is encrypted is a base64 encoded
92      * PNG, the transfer Encoding may be specified as
93      * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as
94      * 'image/png'.
95      * <br>
96      * This attribute is purely advisory; no validation of the MimeType
97      * information is required and it does not indicate the encryption
98      * application must do any additional processing. Note, this information may
99      * not be necessary if it is already bound to the identifier in the Type
100      * attribute. For example, the Element and Content types defined in this
101      * specification are always UTF-8 encoded text.
102      *
103      * @return the media type of the data which was encrypted.
104      */

105     String JavaDoc getMimeType();
106
107     /**
108      * Sets the mime type.
109      *
110      * @param type a <code>String</code> which describes the media type of the
111      * data which has been encrypted.
112      */

113     void setMimeType(String JavaDoc type);
114
115     /**
116      * Retusn an <code>URI</code> representing the encoding of the
117      * <code>EncryptedType</code>.
118      *
119      * @return the encoding of this <code>EncryptedType</code>.
120      */

121     String JavaDoc getEncoding();
122
123     /**
124      * Sets the <code>URI</code> representing the encoding of the
125      * <code>EncryptedType</code>.
126      *
127      * @param encoding.
128      */

129     void setEncoding(String JavaDoc encoding);
130
131     /**
132      * Returns an <code>EncryptionMethod</code> that describes the encryption
133      * algorithm applied to the cipher data. If the element is absent, the
134      * encryption algorithm must be known by the recipient or the decryption
135      * will fail.
136      *
137      * @return the method used to encrypt the cipher data.
138      */

139     EncryptionMethod getEncryptionMethod();
140
141     /**
142      * Sets the <code>EncryptionMethod</code> used to encrypt the cipher data.
143      *
144      * @param method the <code>EncryptionMethod</code>.
145      */

146     void setEncryptionMethod(EncryptionMethod method);
147
148     /**
149      * Returns the <code>ds:KeyInfo</code>, that carries information about the
150      * key used to encrypt the data. Subsequent sections of this specification
151      * define new elements that may appear as children of
152      * <code>ds:KeyInfo</code>.
153      *
154      * @return information about the key that encrypted the cipher data.
155      */

156     KeyInfo getKeyInfo();
157
158     /**
159      * Sets the encryption key information.
160      *
161      * @param info the <code>ds:KeyInfo</code>, that carries information about
162      * the key used to encrypt the data.
163      */

164     void setKeyInfo(KeyInfo info);
165
166     /**
167      * Returns the <code>CipherReference</code> that contains the
168      * <code>CipherValue</code> or <code>CipherReference</code> with the
169      * encrypted data.
170      *
171      * @return the cipher data for the encrypted type.
172      */

173     CipherData getCipherData();
174
175     /**
176      * Returns additional information concerning the generation of the
177      * <code>EncryptedType</code>.
178      *
179      * @return information relating to the generation of the
180      * <code>EncryptedType</code>.
181      */

182     EncryptionProperties getEncryptionProperties();
183
184     /**
185      * Sets the <code>EncryptionProperties</code> that supplies additional
186      * information about the generation of the <code>EncryptedType</code>.
187      *
188      * @param properties.
189      */

190     void setEncryptionProperties(EncryptionProperties properties);
191 }
192
193
Popular Tags