src/share/classes/com/sun/org/apache/xml/internal/security/encryption/CipherReference.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 import org.w3c.dom.Attr;
  24 
  25 
  26 /**
  27  * <code>CipherReference</code> identifies a source which, when processed,
  28  * yields the encrypted octet sequence.
  29  * <p>
  30  * The actual value is obtained as follows. The <code>CipherReference URI</code>
  31  * contains an identifier that is dereferenced. Should the
  32  * <code>CipherReference</code> element contain an OPTIONAL sequence of
  33  * Transforms, the data resulting from dereferencing the <code>URI</code> is
  34  * transformed as specified so as to yield the intended cipher value. For
  35  * example, if the value is base64 encoded within an XML document; the
  36  * transforms could specify an XPath expression followed by a base64 decoding so
  37  * as to extract the octets.
  38  * <p>
  39  * The syntax of the <code>URI</code> and Transforms is similar to that of
  40  * [XML-DSIG]. However, there is a difference between signature and encryption
  41  * processing. In [XML-DSIG] both generation and validation processing start
  42  * with the same source data and perform that transform in the same order. In
  43  * encryption, the decryptor has only the cipher data and the specified
  44  * transforms are enumerated for the decryptor, in the order necessary to obtain
  45  * the octets. Consequently, because it has different semantics Transforms is in
  46  * the &xenc; namespace.
  47  * <p>
  48  * The schema definition is as follows:
  49  * <xmp>
  50  * <element name='CipherReference' type='xenc:CipherReferenceType'/>
  51  * <complexType name='CipherReferenceType'>
  52  *     <sequence>
  53  *         <element name='Transforms' type='xenc:TransformsType' minOccurs='0'/>
  54  *     </sequence>
  55  *     <attribute name='URI' type='anyURI' use='required'/>
  56  * </complexType>
  57  * </xmp>
  58  *
  59  * @author Axl Mattheus
  60  */
  61 public interface CipherReference {
  62     /**
  63      * Returns an <code>URI</code> that contains an identifier that should be
  64      * dereferenced.
  65      * @return

  66      */
  67     String getURI();
  68 
  69         /**
  70          * Gets the URI as an Attribute node.  Used to meld the CipherREference
  71          * with the XMLSignature ResourceResolvers
  72      * @return
  73          */
  74         public Attr getURIAsAttr();
  75 
  76     /**
  77      * Returns the <code>Transforms</code> that specifies how to transform the
  78      * <code>URI</code> to yield the appropiate cipher value.
  79      *
  80      * @return the transform that specifies how to transform the reference to
  81      *   yield the intended cipher value.
  82      */
  83     Transforms getTransforms();
  84 
  85     /**
  86      * Sets the <code>Transforms</code> that specifies how to transform the
  87      * <code>URI</code> to yield the appropiate cipher value.
  88      *
  89      * @param transforms the set of <code>Transforms</code> that specifies how
  90      *   to transform the reference to yield the intended cipher value.
  91      */
  92     void setTransforms(Transforms transforms);
  93 }

   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 org.w3c.dom.Attr;
  26 

  27 /**
  28  * <code>CipherReference</code> identifies a source which, when processed,
  29  * yields the encrypted octet sequence.
  30  * <p>
  31  * The actual value is obtained as follows. The <code>CipherReference URI</code>
  32  * contains an identifier that is dereferenced. Should the

  33  * Transforms, the data resulting from dereferencing the <code>URI</code> is
  34  * transformed as specified so as to yield the intended cipher value. For
  35  * example, if the value is base64 encoded within an XML document; the
  36  * transforms could specify an XPath expression followed by a base64 decoding so
  37  * as to extract the octets.
  38  * <p>
  39  * The syntax of the <code>URI</code> and Transforms is similar to that of
  40  * [XML-DSIG]. However, there is a difference between signature and encryption
  41  * processing. In [XML-DSIG] both generation and validation processing start
  42  * with the same source data and perform that transform in the same order. In
  43  * encryption, the decryptor has only the cipher data and the specified
  44  * transforms are enumerated for the decryptor, in the order necessary to obtain
  45  * the octets. Consequently, because it has different semantics Transforms is in
  46  * the &xenc; namespace.
  47  * <p>
  48  * The schema definition is as follows:
  49  * <xmp>
  50  * <element name='CipherReference' type='xenc:CipherReferenceType'/>
  51  * <complexType name='CipherReferenceType'>
  52  *     <sequence>
  53  *         <element name='Transforms' type='xenc:TransformsType' minOccurs='0'/>
  54  *     </sequence>
  55  *     <attribute name='URI' type='anyURI' use='required'/>
  56  * </complexType>
  57  * </xmp>
  58  *
  59  * @author Axl Mattheus
  60  */
  61 public interface CipherReference {
  62     /**
  63      * Returns an <code>URI</code> that contains an identifier that should be
  64      * dereferenced.
  65      * @return an <code>URI</code> that contains an identifier that should be
  66      * dereferenced.
  67      */
  68     String getURI();
  69 
  70     /**
  71      * Gets the URI as an Attribute node.  Used to meld the CipherReference
  72      * with the XMLSignature ResourceResolvers
  73      * @return the URI as an Attribute node
  74      */
  75     Attr getURIAsAttr();
  76 
  77     /**
  78      * Returns the <code>Transforms</code> that specifies how to transform the
  79      * <code>URI</code> to yield the appropriate cipher value.
  80      *
  81      * @return the transform that specifies how to transform the reference to
  82      *   yield the intended cipher value.
  83      */
  84     Transforms getTransforms();
  85 
  86     /**
  87      * Sets the <code>Transforms</code> that specifies how to transform the
  88      * <code>URI</code> to yield the appropriate cipher value.
  89      *
  90      * @param transforms the set of <code>Transforms</code> that specifies how
  91      *   to transform the reference to yield the intended cipher value.
  92      */
  93     void setTransforms(Transforms transforms);
  94 }
  95