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

Print this page


   1 /*
   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  */
  21 package com.sun.org.apache.xml.internal.security.encryption;
  22 
  23 
  24 import 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  */
  52 public 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     /**


 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 


 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 }

   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /**
   6  * Licensed to the Apache Software Foundation (ASF) under one
   7  * or more contributor license agreements. See the NOTICE file
   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     /**


 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 


 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