blob: 17ffded82a5d85eb75ae72716411537f25ad571c [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Copyright 2003-2004 The Apache Software Foundation.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21package com.sun.org.apache.xml.internal.security.encryption;
22
23
24import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
25
26
27/**
28 * EncryptedType is the abstract type from which <code>EncryptedData</code> and
29 * <code>EncryptedKey</code> are derived. While these two latter element types
30 * are very similar with respect to their content models, a syntactical
31 * distinction is useful to processing.
32 * <p>
33 * Its schema definition is as follows:
34 * <xmp>
35 * <complexType name='EncryptedType' abstract='true'>
36 * <sequence>
37 * <element name='EncryptionMethod' type='xenc:EncryptionMethodType'
38 * minOccurs='0'/>
39 * <element ref='ds:KeyInfo' minOccurs='0'/>
40 * <element ref='xenc:CipherData'/>
41 * <element ref='xenc:EncryptionProperties' minOccurs='0'/>
42 * </sequence>
43 * <attribute name='Id' type='ID' use='optional'/>
44 * <attribute name='Type' type='anyURI' use='optional'/>
45 * <attribute name='MimeType' type='string' use='optional'/>
46 * <attribute name='Encoding' type='anyURI' use='optional'/>
47 * </complexType>
48 * </xmp>
49 *
50 * @author Axl Mattheus
51 */
52public interface EncryptedType {
53 /**
54 * Returns a <code>String</code> providing for the standard method of
55 * assigning an id to the element within the document context.
56 *
57 * @return the id for the <code>EncryptedType</code>.
58 */
59 String getId();
60
61 /**
62 * Sets the id.
63 *
64 * @param id.
65 */
66 void setId(String id);
67
68 /**
69 * Returns an <code>URI</code> identifying type information about the
70 * plaintext form of the encrypted content. While optional, this
71 * specification takes advantage of it for mandatory processing described in
72 * Processing Rules: Decryption (section 4.2). If the
73 * <code>EncryptedData</code> element contains data of Type 'element' or
74 * element 'content', and replaces that data in an XML document context, it
75 * is strongly recommended the Type attribute be provided. Without this
76 * information, the decryptor will be unable to automatically restore the
77 * XML document to its original cleartext form.
78 *
79 * @return the identifier for the type of information in plaintext form of
80 * encrypted content.
81 */
82 String getType();
83
84 /**
85 * Sets the type.
86 *
87 * @param type an <code>URI</code> identifying type information about the
88 * plaintext form of the encrypted content.
89 */
90 void setType(String type);
91
92 /**
93 * Returns a <code>String</code> which describes the media type of the data
94 * which has been encrypted. The value of this attribute has values defined
95 * by [MIME]. For example, if the data that is encrypted is a base64 encoded
96 * PNG, the transfer Encoding may be specified as
97 * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as
98 * 'image/png'.
99 * <br>
100 * This attribute is purely advisory; no validation of the MimeType
101 * information is required and it does not indicate the encryption
102 * application must do any additional processing. Note, this information may
103 * not be necessary if it is already bound to the identifier in the Type
104 * attribute. For example, the Element and Content types defined in this
105 * specification are always UTF-8 encoded text.
106 *
107 * @return the media type of the data which was encrypted.
108 */
109 String getMimeType();
110
111 /**
112 * Sets the mime type.
113 *
114 * @param type a <code>String</code> which describes the media type of the
115 * data which has been encrypted.
116 */
117 void setMimeType(String type);
118
119 /**
120 * Retusn an <code>URI</code> representing the encoding of the
121 * <code>EncryptedType</code>.
122 *
123 * @return the encoding of this <code>EncryptedType</code>.
124 */
125 String getEncoding();
126
127 /**
128 * Sets the <code>URI</code> representing the encoding of the
129 * <code>EncryptedType</code>.
130 *
131 * @param encoding.
132 */
133 void setEncoding(String encoding);
134
135 /**
136 * Returns an <code>EncryptionMethod</code> that describes the encryption
137 * algorithm applied to the cipher data. If the element is absent, the
138 * encryption algorithm must be known by the recipient or the decryption
139 * will fail.
140 *
141 * @return the method used to encrypt the cipher data.
142 */
143 EncryptionMethod getEncryptionMethod();
144
145 /**
146 * Sets the <code>EncryptionMethod</code> used to encrypt the cipher data.
147 *
148 * @param method the <code>EncryptionMethod</code>.
149 */
150 void setEncryptionMethod(EncryptionMethod method);
151
152 /**
153 * Returns the <code>ds:KeyInfo</code>, that carries information about the
154 * key used to encrypt the data. Subsequent sections of this specification
155 * define new elements that may appear as children of
156 * <code>ds:KeyInfo</code>.
157 *
158 * @return information about the key that encrypted the cipher data.
159 */
160 KeyInfo getKeyInfo();
161
162 /**
163 * Sets the encryption key information.
164 *
165 * @param info the <code>ds:KeyInfo</code>, that carries information about
166 * the key used to encrypt the data.
167 */
168 void setKeyInfo(KeyInfo info);
169
170 /**
171 * Returns the <code>CipherReference</code> that contains the
172 * <code>CipherValue</code> or <code>CipherReference</code> with the
173 * encrypted data.
174 *
175 * @return the cipher data for the encrypted type.
176 */
177 CipherData getCipherData();
178
179 /**
180 * Returns additional information concerning the generation of the
181 * <code>EncryptedType</code>.
182 *
183 * @return information relating to the generation of the
184 * <code>EncryptedType</code>.
185 */
186 EncryptionProperties getEncryptionProperties();
187
188 /**
189 * Sets the <code>EncryptionProperties</code> that supplies additional
190 * information about the generation of the <code>EncryptedType</code>.
191 *
192 * @param properties.
193 */
194 void setEncryptionProperties(EncryptionProperties properties);
195}