KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > security > encryption > CipherData


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
20 /**
21  * <code>CipherData</code> provides encrypted data. It must either contain the
22  * encrypted octet sequence as base64 encoded text of the
23  * <code>CipherValue</code> element, or provide a reference to an external
24  * location containing the encrypted octet sequence via the
25  * <code>CipherReference</code> element.
26  * <p>
27  * The schema definition is as follows:
28  * <xmp>
29  * <element name='CipherData' type='xenc:CipherDataType'/>
30  * <complexType name='CipherDataType'>
31  * <choice>
32  * <element name='CipherValue' type='base64Binary'/>
33  * <element ref='xenc:CipherReference'/>
34  * </choice>
35  * </complexType>
36  * </xmp>
37  *
38  * @author Axl Mattheus
39  */

40 public interface CipherData {
41     /** VALUE_TYPE ASN */
42     public static final int VALUE_TYPE = 0x00000001;
43     /** REFERENCE_TYPE ASN */
44     public static final int REFERENCE_TYPE = 0x00000002;
45
46     /**
47      * Returns the type of encrypted data contained in the
48      * <code>CipherData</code>.
49      *
50      * @return <code>VALUE_TYPE</code> if the encrypted data is contained as
51      * <code>CipherValue</code> or <code>REFERENCE_TYPE</code> if the
52      * encrypted data is contained as <code>CipherReference</code>.
53      */

54     int getDataType();
55
56     /**
57      * Returns the cipher value as a base64 encoded <code>byte</code> array.
58      *
59      * @return the <code>CipherData</code>'s value.
60      */

61     CipherValue getCipherValue();
62
63     /**
64      * Sets the <code>CipherData</code>'s value.
65      *
66      * @param value the value of the <code>CipherData</code>.
67      * @throws XMLEncryptionException
68      */

69     void setCipherValue(CipherValue value) throws XMLEncryptionException;
70
71     /**
72      * Returns a reference to an external location containing the encrypted
73      * octet sequence (<code>byte</code> array).
74      *
75      * @return the reference to an external location containing the enctrypted
76      * octet sequence.
77      */

78     CipherReference getCipherReference();
79
80     /**
81      * Sets the <code>CipherData</code>'s reference.
82      *
83      * @param reference an external location containing the enctrypted octet
84      * sequence.
85      * @throws XMLEncryptionException
86      */

87     void setCipherReference(CipherReference reference) throws
88         XMLEncryptionException;
89 }
90
91
Popular Tags