< prev index next >

src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptedType.java

Print this page




   8  * distributed with this work for additional information
   9  * regarding copyright ownership. The ASF licenses this file
  10  * to you under the Apache License, Version 2.0 (the
  11  * "License"); you may not use this file except in compliance
  12  * with the License. You may obtain a copy of the License at
  13  *
  14  * http://www.apache.org/licenses/LICENSE-2.0
  15  *
  16  * Unless required by applicable law or agreed to in writing,
  17  * software distributed under the License is distributed on an
  18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19  * KIND, either express or implied. See the License for the
  20  * specific language governing permissions and limitations
  21  * under the License.
  22  */
  23 package com.sun.org.apache.xml.internal.security.encryption;
  24 
  25 import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
  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  */
  52 public interface EncryptedType {
  53 
  54     /**
  55      * Returns a <code>String</code> providing for the standard method of
  56      * assigning an id to the element within the document context.
  57      *
  58      * @return the id for the <code>EncryptedType</code>.
  59      */
  60     String getId();
  61 
  62     /**
  63      * Sets the id.
  64      *
  65      * @param id
  66      */
  67     void setId(String id);
  68 
  69     /**
  70      * Returns an <code>URI</code> identifying type information about the
  71      * plaintext form of the encrypted content. While optional, this
  72      * specification takes advantage of it for mandatory processing described in
  73      * Processing Rules: Decryption (section 4.2). If the
  74      * <code>EncryptedData</code> element contains data of Type 'element' or
  75      * element 'content', and replaces that data in an XML document context, it
  76      * is strongly recommended the Type attribute be provided. Without this
  77      * information, the decryptor will be unable to automatically restore the
  78      * XML document to its original cleartext form.
  79      *
  80      * @return the identifier for the type of information in plaintext form of
  81      *   encrypted content.
  82      */
  83     String getType();
  84 
  85     /**
  86      * Sets the type.
  87      *
  88      * @param type an <code>URI</code> identifying type information about the
  89      *   plaintext form of the encrypted content.
  90      */
  91     void setType(String type);
  92 
  93     /**
  94      * Returns a <code>String</code> which describes the media type of the data
  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
  97      * PNG, the transfer Encoding may be specified as
  98      * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as
  99      * 'image/png'.
 100      * <br>
 101      * This attribute is purely advisory; no validation of the MimeType
 102      * information is required and it does not indicate the encryption
 103      * application must do any additional processing. Note, this information may
 104      * not be necessary if it is already bound to the identifier in the Type
 105      * attribute. For example, the Element and Content types defined in this
 106      * specification are always UTF-8 encoded text.
 107      *
 108      * @return the media type of the data which was encrypted.
 109      */
 110     String getMimeType();
 111 
 112     /**
 113      * Sets the mime type.
 114      *
 115      * @param type a <code>String</code> which describes the media type of the
 116      *   data which has been encrypted.
 117      */
 118     void setMimeType(String type);
 119 
 120     /**
 121      * Return an <code>URI</code> representing the encoding of the
 122      * <code>EncryptedType</code>.
 123      *
 124      * @return the encoding of this <code>EncryptedType</code>.
 125      */
 126     String getEncoding();
 127 
 128     /**
 129      * Sets the <code>URI</code> representing the encoding of the
 130      * <code>EncryptedType</code>.
 131      *
 132      * @param encoding
 133      */
 134     void setEncoding(String encoding);
 135 
 136     /**
 137      * Returns an <code>EncryptionMethod</code> that describes the encryption
 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
 140      * will fail.
 141      *
 142      * @return the method used to encrypt the cipher data.
 143      */
 144     EncryptionMethod getEncryptionMethod();
 145 
 146     /**
 147      * Sets the <code>EncryptionMethod</code> used to encrypt the cipher data.
 148      *
 149      * @param method the <code>EncryptionMethod</code>.
 150      */
 151     void setEncryptionMethod(EncryptionMethod method);
 152 
 153     /**
 154      * Returns the <code>ds:KeyInfo</code>, that carries information about the
 155      * key used to encrypt the data. Subsequent sections of this specification
 156      * define new elements that may appear as children of
 157      * <code>ds:KeyInfo</code>.
 158      *
 159      * @return information about the key that encrypted the cipher data.
 160      */
 161     KeyInfo getKeyInfo();
 162 
 163     /**
 164      * Sets the encryption key information.
 165      *
 166      * @param info the <code>ds:KeyInfo</code>, that carries information about
 167      *   the key used to encrypt the data.
 168      */
 169     void setKeyInfo(KeyInfo info);
 170 
 171     /**
 172      * Returns the <code>CipherReference</code> that contains the
 173      * <code>CipherValue</code> or <code>CipherReference</code> with the
 174      * encrypted data.
 175      *
 176      * @return the cipher data for the encrypted type.
 177      */
 178     CipherData getCipherData();
 179 
 180     /**
 181      * Returns additional information concerning the generation of the
 182      * <code>EncryptedType</code>.
 183      *
 184      * @return information relating to the generation of the
 185      *   <code>EncryptedType</code>.
 186      */
 187     EncryptionProperties getEncryptionProperties();
 188 
 189     /**
 190      * Sets the <code>EncryptionProperties</code> that supplies additional
 191      * information about the generation of the <code>EncryptedType</code>.
 192      *
 193      * @param properties
 194      */
 195     void setEncryptionProperties(EncryptionProperties properties);
 196 }
 197 


   8  * distributed with this work for additional information
   9  * regarding copyright ownership. The ASF licenses this file
  10  * to you under the Apache License, Version 2.0 (the
  11  * "License"); you may not use this file except in compliance
  12  * with the License. You may obtain a copy of the License at
  13  *
  14  * http://www.apache.org/licenses/LICENSE-2.0
  15  *
  16  * Unless required by applicable law or agreed to in writing,
  17  * software distributed under the License is distributed on an
  18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19  * KIND, either express or implied. See the License for the
  20  * specific language governing permissions and limitations
  21  * under the License.
  22  */
  23 package com.sun.org.apache.xml.internal.security.encryption;
  24 
  25 import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
  26 
  27 /**
  28  * EncryptedType is the abstract type from which {@code EncryptedData} and
  29  * {@code EncryptedKey} 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  * <pre>{@code
  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  * }</pre>
  49  *
  50  * @author Axl Mattheus
  51  */
  52 public interface EncryptedType {
  53 
  54     /**
  55      * Returns a {@code String} providing for the standard method of
  56      * assigning an id to the element within the document context.
  57      *
  58      * @return the id for the {@code EncryptedType}.
  59      */
  60     String getId();
  61 
  62     /**
  63      * Sets the id.
  64      *
  65      * @param id
  66      */
  67     void setId(String id);
  68 
  69     /**
  70      * Returns an {@code URI} identifying type information about the
  71      * plaintext form of the encrypted content. While optional, this
  72      * specification takes advantage of it for mandatory processing described in
  73      * Processing Rules: Decryption (section 4.2). If the
  74      * {@code EncryptedData} element contains data of Type 'element' or
  75      * element 'content', and replaces that data in an XML document context, it
  76      * is strongly recommended the Type attribute be provided. Without this
  77      * information, the decryptor will be unable to automatically restore the
  78      * XML document to its original cleartext form.
  79      *
  80      * @return the identifier for the type of information in plaintext form of
  81      *   encrypted content.
  82      */
  83     String getType();
  84 
  85     /**
  86      * Sets the type.
  87      *
  88      * @param type an {@code URI} identifying type information about the
  89      *   plaintext form of the encrypted content.
  90      */
  91     void setType(String type);
  92 
  93     /**
  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
  96      * by [MIME]. For example, if the data that is encrypted is a base64 encoded
  97      * PNG, the transfer Encoding may be specified as
  98      * 'http://www.w3.org/2000/09/xmldsig#base64' and the MimeType as
  99      * 'image/png'.
 100      * <br>
 101      * This attribute is purely advisory; no validation of the MimeType
 102      * information is required and it does not indicate the encryption
 103      * application must do any additional processing. Note, this information may
 104      * not be necessary if it is already bound to the identifier in the Type
 105      * attribute. For example, the Element and Content types defined in this
 106      * specification are always UTF-8 encoded text.
 107      *
 108      * @return the media type of the data which was encrypted.
 109      */
 110     String getMimeType();
 111 
 112     /**
 113      * Sets the mime type.
 114      *
 115      * @param type a {@code String} which describes the media type of the
 116      *   data which has been encrypted.
 117      */
 118     void setMimeType(String type);
 119 
 120     /**
 121      * Return an {@code URI} representing the encoding of the
 122      * {@code EncryptedType}.
 123      *
 124      * @return the encoding of this {@code EncryptedType}.
 125      */
 126     String getEncoding();
 127 
 128     /**
 129      * Sets the {@code URI} representing the encoding of the
 130      * {@code EncryptedType}.
 131      *
 132      * @param encoding
 133      */
 134     void setEncoding(String encoding);
 135 
 136     /**
 137      * Returns an {@code EncryptionMethod} that describes the encryption
 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
 140      * will fail.
 141      *
 142      * @return the method used to encrypt the cipher data.
 143      */
 144     EncryptionMethod getEncryptionMethod();
 145 
 146     /**
 147      * Sets the {@code EncryptionMethod} used to encrypt the cipher data.
 148      *
 149      * @param method the {@code EncryptionMethod}.
 150      */
 151     void setEncryptionMethod(EncryptionMethod method);
 152 
 153     /**
 154      * Returns the {@code ds:KeyInfo}, that carries information about the
 155      * key used to encrypt the data. Subsequent sections of this specification
 156      * define new elements that may appear as children of
 157      * {@code ds:KeyInfo}.
 158      *
 159      * @return information about the key that encrypted the cipher data.
 160      */
 161     KeyInfo getKeyInfo();
 162 
 163     /**
 164      * Sets the encryption key information.
 165      *
 166      * @param info the {@code ds:KeyInfo}, that carries information about
 167      *   the key used to encrypt the data.
 168      */
 169     void setKeyInfo(KeyInfo info);
 170 
 171     /**
 172      * Returns the {@code CipherReference} that contains the
 173      * {@code CipherValue} or {@code CipherReference} with the
 174      * encrypted data.
 175      *
 176      * @return the cipher data for the encrypted type.
 177      */
 178     CipherData getCipherData();
 179 
 180     /**
 181      * Returns additional information concerning the generation of the
 182      * {@code EncryptedType}.
 183      *
 184      * @return information relating to the generation of the
 185      *   {@code EncryptedType}.
 186      */
 187     EncryptionProperties getEncryptionProperties();
 188 
 189     /**
 190      * Sets the {@code EncryptionProperties} that supplies additional
 191      * information about the generation of the {@code EncryptedType}.
 192      *
 193      * @param properties
 194      */
 195     void setEncryptionProperties(EncryptionProperties properties);
 196 }
 197 
< prev index next >