1 /* 2 * Copyright 2003-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 package com.sun.org.apache.xml.internal.security.encryption; 18 19 import org.w3c.dom.Attr; 20 21 22 /** 23 * <code>CipherReference</code> identifies a source which, when processed, 24 * yields the encrypted octet sequence. 25 * <p> 26 * The actual value is obtained as follows. The <code>CipherReference URI</code> 27 * contains an identifier that is dereferenced. Should the 28 * <code>CipherReference</code> element contain an OPTIONAL sequence of 29 * Transforms, the data resulting from dereferencing the <code>URI</code> is 30 * transformed as specified so as to yield the intended cipher value. For 31 * example, if the value is base64 encoded within an XML document; the 32 * transforms could specify an XPath expression followed by a base64 decoding so 33 * as to extract the octets. 34 * <p> 35 * The syntax of the <code>URI</code> and Transforms is similar to that of 36 * [XML-DSIG]. However, there is a difference between signature and encryption 37 * processing. In [XML-DSIG] both generation and validation processing start 38 * with the same source data and perform that transform in the same order. In 39 * encryption, the decryptor has only the cipher data and the specified 40 * transforms are enumerated for the decryptor, in the order necessary to obtain 41 * the octets. Consequently, because it has different semantics Transforms is in 42 * the &xenc; namespace. 43 * <p> 44 * The schema definition is as follows: 45 * <xmp> 46 * <element name='CipherReference' type='xenc:CipherReferenceType'/> 47 * <complexType name='CipherReferenceType'> 48 * <sequence> 49 * <element name='Transforms' type='xenc:TransformsType' minOccurs='0'/> 50 * </sequence> 51 * <attribute name='URI' type='anyURI' use='required'/> 52 * </complexType> 53 * </xmp> 54 * 55 * @author Axl Mattheus 56 */ 57 public interface CipherReference { 58 /** 59 * Returns an <code>URI</code> that contains an identifier that should be 60 * dereferenced. 61 * @return 62 */ 63 String getURI(); 64 65 /** 66 * Gets the URI as an Attribute node. Used to meld the CipherREference 67 * with the XMLSignature ResourceResolvers 68 * @return 69 */ 70 public Attr getURIAsAttr(); 71 72 /** 73 * Returns the <code>Transforms</code> that specifies how to transform the 74 * <code>URI</code> to yield the appropiate cipher value. 75 * 76 * @return the transform that specifies how to transform the reference to 77 * yield the intended cipher value. 78 */ 79 Transforms getTransforms(); 80 81 /** 82 * Sets the <code>Transforms</code> that specifies how to transform the 83 * <code>URI</code> to yield the appropiate cipher value. 84 * 85 * @param transforms the set of <code>Transforms</code> that specifies how 86 * to transform the reference to yield the intended cipher value. 87 */ 88 void setTransforms(Transforms transforms); 89 } 90 91