23 package com.sun.org.apache.xml.internal.security.encryption; |
23 package com.sun.org.apache.xml.internal.security.encryption; |
24 |
24 |
25 import com.sun.org.apache.xml.internal.security.keys.KeyInfo; |
25 import com.sun.org.apache.xml.internal.security.keys.KeyInfo; |
26 |
26 |
27 /** |
27 /** |
28 * EncryptedType is the abstract type from which <code>EncryptedData</code> and |
28 * EncryptedType is the abstract type from which {@code EncryptedData} and |
29 * <code>EncryptedKey</code> are derived. While these two latter element types |
29 * {@code EncryptedKey} are derived. While these two latter element types |
30 * are very similar with respect to their content models, a syntactical |
30 * are very similar with respect to their content models, a syntactical |
31 * distinction is useful to processing. |
31 * distinction is useful to processing. |
32 * <p> |
32 * <p> |
33 * Its schema definition is as follows: |
33 * Its schema definition is as follows: |
34 * <xmp> |
34 * <pre>{@code |
35 * <complexType name='EncryptedType' abstract='true'> |
35 * <complexType name='EncryptedType' abstract='true'> |
36 * <sequence> |
36 * <sequence> |
37 * <element name='EncryptionMethod' type='xenc:EncryptionMethodType' |
37 * <element name='EncryptionMethod' type='xenc:EncryptionMethodType' |
38 * minOccurs='0'/> |
38 * minOccurs='0'/> |
39 * <element ref='ds:KeyInfo' minOccurs='0'/> |
39 * <element ref='ds:KeyInfo' minOccurs='0'/> |
43 * <attribute name='Id' type='ID' use='optional'/> |
43 * <attribute name='Id' type='ID' use='optional'/> |
44 * <attribute name='Type' type='anyURI' use='optional'/> |
44 * <attribute name='Type' type='anyURI' use='optional'/> |
45 * <attribute name='MimeType' type='string' use='optional'/> |
45 * <attribute name='MimeType' type='string' use='optional'/> |
46 * <attribute name='Encoding' type='anyURI' use='optional'/> |
46 * <attribute name='Encoding' type='anyURI' use='optional'/> |
47 * </complexType> |
47 * </complexType> |
48 * </xmp> |
48 * }</pre> |
49 * |
49 * |
50 * @author Axl Mattheus |
50 * @author Axl Mattheus |
51 */ |
51 */ |
52 public interface EncryptedType { |
52 public interface EncryptedType { |
53 |
53 |
54 /** |
54 /** |
55 * Returns a <code>String</code> providing for the standard method of |
55 * Returns a {@code String} providing for the standard method of |
56 * assigning an id to the element within the document context. |
56 * assigning an id to the element within the document context. |
57 * |
57 * |
58 * @return the id for the <code>EncryptedType</code>. |
58 * @return the id for the {@code EncryptedType}. |
59 */ |
59 */ |
60 String getId(); |
60 String getId(); |
61 |
61 |
62 /** |
62 /** |
63 * Sets the id. |
63 * Sets the id. |
65 * @param id |
65 * @param id |
66 */ |
66 */ |
67 void setId(String id); |
67 void setId(String id); |
68 |
68 |
69 /** |
69 /** |
70 * Returns an <code>URI</code> identifying type information about the |
70 * Returns an {@code URI} identifying type information about the |
71 * plaintext form of the encrypted content. While optional, this |
71 * plaintext form of the encrypted content. While optional, this |
72 * specification takes advantage of it for mandatory processing described in |
72 * specification takes advantage of it for mandatory processing described in |
73 * Processing Rules: Decryption (section 4.2). If the |
73 * Processing Rules: Decryption (section 4.2). If the |
74 * <code>EncryptedData</code> element contains data of Type 'element' or |
74 * {@code EncryptedData} element contains data of Type 'element' or |
75 * element 'content', and replaces that data in an XML document context, it |
75 * element 'content', and replaces that data in an XML document context, it |
76 * is strongly recommended the Type attribute be provided. Without this |
76 * is strongly recommended the Type attribute be provided. Without this |
77 * information, the decryptor will be unable to automatically restore the |
77 * information, the decryptor will be unable to automatically restore the |
78 * XML document to its original cleartext form. |
78 * XML document to its original cleartext form. |
79 * |
79 * |
83 String getType(); |
83 String getType(); |
84 |
84 |
85 /** |
85 /** |
86 * Sets the type. |
86 * Sets the type. |
87 * |
87 * |
88 * @param type an <code>URI</code> identifying type information about the |
88 * @param type an {@code URI} identifying type information about the |
89 * plaintext form of the encrypted content. |
89 * plaintext form of the encrypted content. |
90 */ |
90 */ |
91 void setType(String type); |
91 void setType(String type); |
92 |
92 |
93 /** |
93 /** |
94 * Returns a <code>String</code> which describes the media type of the data |
94 * Returns a {@code String} which describes the media type of the data |
95 * which has been encrypted. The value of this attribute has values defined |
95 * which has been encrypted. The value of this attribute has values defined |
96 * by [MIME]. For example, if the data that is encrypted is a base64 encoded |
96 * by [MIME]. For example, if the data that is encrypted is a base64 encoded |
97 * PNG, the transfer Encoding may be specified as |
97 * PNG, the transfer Encoding may be specified as |
98 * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as |
98 * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as |
99 * 'image/png'. |
99 * 'image/png'. |
110 String getMimeType(); |
110 String getMimeType(); |
111 |
111 |
112 /** |
112 /** |
113 * Sets the mime type. |
113 * Sets the mime type. |
114 * |
114 * |
115 * @param type a <code>String</code> which describes the media type of the |
115 * @param type a {@code String} which describes the media type of the |
116 * data which has been encrypted. |
116 * data which has been encrypted. |
117 */ |
117 */ |
118 void setMimeType(String type); |
118 void setMimeType(String type); |
119 |
119 |
120 /** |
120 /** |
121 * Return an <code>URI</code> representing the encoding of the |
121 * Return an {@code URI} representing the encoding of the |
122 * <code>EncryptedType</code>. |
122 * {@code EncryptedType}. |
123 * |
123 * |
124 * @return the encoding of this <code>EncryptedType</code>. |
124 * @return the encoding of this {@code EncryptedType}. |
125 */ |
125 */ |
126 String getEncoding(); |
126 String getEncoding(); |
127 |
127 |
128 /** |
128 /** |
129 * Sets the <code>URI</code> representing the encoding of the |
129 * Sets the {@code URI} representing the encoding of the |
130 * <code>EncryptedType</code>. |
130 * {@code EncryptedType}. |
131 * |
131 * |
132 * @param encoding |
132 * @param encoding |
133 */ |
133 */ |
134 void setEncoding(String encoding); |
134 void setEncoding(String encoding); |
135 |
135 |
136 /** |
136 /** |
137 * Returns an <code>EncryptionMethod</code> that describes the encryption |
137 * Returns an {@code EncryptionMethod} that describes the encryption |
138 * algorithm applied to the cipher data. If the element is absent, the |
138 * algorithm applied to the cipher data. If the element is absent, the |
139 * encryption algorithm must be known by the recipient or the decryption |
139 * encryption algorithm must be known by the recipient or the decryption |
140 * will fail. |
140 * will fail. |
141 * |
141 * |
142 * @return the method used to encrypt the cipher data. |
142 * @return the method used to encrypt the cipher data. |
143 */ |
143 */ |
144 EncryptionMethod getEncryptionMethod(); |
144 EncryptionMethod getEncryptionMethod(); |
145 |
145 |
146 /** |
146 /** |
147 * Sets the <code>EncryptionMethod</code> used to encrypt the cipher data. |
147 * Sets the {@code EncryptionMethod} used to encrypt the cipher data. |
148 * |
148 * |
149 * @param method the <code>EncryptionMethod</code>. |
149 * @param method the {@code EncryptionMethod}. |
150 */ |
150 */ |
151 void setEncryptionMethod(EncryptionMethod method); |
151 void setEncryptionMethod(EncryptionMethod method); |
152 |
152 |
153 /** |
153 /** |
154 * Returns the <code>ds:KeyInfo</code>, that carries information about the |
154 * Returns the {@code ds:KeyInfo}, that carries information about the |
155 * key used to encrypt the data. Subsequent sections of this specification |
155 * key used to encrypt the data. Subsequent sections of this specification |
156 * define new elements that may appear as children of |
156 * define new elements that may appear as children of |
157 * <code>ds:KeyInfo</code>. |
157 * {@code ds:KeyInfo}. |
158 * |
158 * |
159 * @return information about the key that encrypted the cipher data. |
159 * @return information about the key that encrypted the cipher data. |
160 */ |
160 */ |
161 KeyInfo getKeyInfo(); |
161 KeyInfo getKeyInfo(); |
162 |
162 |
163 /** |
163 /** |
164 * Sets the encryption key information. |
164 * Sets the encryption key information. |
165 * |
165 * |
166 * @param info the <code>ds:KeyInfo</code>, that carries information about |
166 * @param info the {@code ds:KeyInfo}, that carries information about |
167 * the key used to encrypt the data. |
167 * the key used to encrypt the data. |
168 */ |
168 */ |
169 void setKeyInfo(KeyInfo info); |
169 void setKeyInfo(KeyInfo info); |
170 |
170 |
171 /** |
171 /** |
172 * Returns the <code>CipherReference</code> that contains the |
172 * Returns the {@code CipherReference} that contains the |
173 * <code>CipherValue</code> or <code>CipherReference</code> with the |
173 * {@code CipherValue} or {@code CipherReference} with the |
174 * encrypted data. |
174 * encrypted data. |
175 * |
175 * |
176 * @return the cipher data for the encrypted type. |
176 * @return the cipher data for the encrypted type. |
177 */ |
177 */ |
178 CipherData getCipherData(); |
178 CipherData getCipherData(); |
179 |
179 |
180 /** |
180 /** |
181 * Returns additional information concerning the generation of the |
181 * Returns additional information concerning the generation of the |
182 * <code>EncryptedType</code>. |
182 * {@code EncryptedType}. |
183 * |
183 * |
184 * @return information relating to the generation of the |
184 * @return information relating to the generation of the |
185 * <code>EncryptedType</code>. |
185 * {@code EncryptedType}. |
186 */ |
186 */ |
187 EncryptionProperties getEncryptionProperties(); |
187 EncryptionProperties getEncryptionProperties(); |
188 |
188 |
189 /** |
189 /** |
190 * Sets the <code>EncryptionProperties</code> that supplies additional |
190 * Sets the {@code EncryptionProperties} that supplies additional |
191 * information about the generation of the <code>EncryptedType</code>. |
191 * information about the generation of the {@code EncryptedType}. |
192 * |
192 * |
193 * @param properties |
193 * @param properties |
194 */ |
194 */ |
195 void setEncryptionProperties(EncryptionProperties properties); |
195 void setEncryptionProperties(EncryptionProperties properties); |
196 } |
196 } |