KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > security > utils > EncryptionConstants


1 /*
2  * Copyright 1999-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.utils;
18
19
20
21 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
22
23
24 /**
25  *
26  * @author $Author: raul $
27  */

28 public class EncryptionConstants {
29    //J-
30
// Attributes that exist in XML Signature in the same way
31
/** Tag of Attr Algorithm **/
32    public static final String JavaDoc _ATT_ALGORITHM = Constants._ATT_ALGORITHM;
33    /** Tag of Attr Id**/
34    public static final String JavaDoc _ATT_ID = Constants._ATT_ID;
35    /** Tag of Attr Target **/
36    public static final String JavaDoc _ATT_TARGET = Constants._ATT_TARGET;
37    /** Tag of Attr Type **/
38    public static final String JavaDoc _ATT_TYPE = Constants._ATT_TYPE;
39    /** Tag of Attr URI **/
40    public static final String JavaDoc _ATT_URI = Constants._ATT_URI;
41
42    // Attributes new in XML Encryption
43
/** Tag of Attr encoding **/
44    public static final String JavaDoc _ATT_ENCODING = "Encoding";
45    /** Tag of Attr recipient **/
46    public static final String JavaDoc _ATT_RECIPIENT = "Recipient";
47    /** Tag of Attr mimetype **/
48    public static final String JavaDoc _ATT_MIMETYPE = "MimeType";
49
50    /** Tag of Element CarriedKeyName **/
51    public static final String JavaDoc _TAG_CARRIEDKEYNAME = "CarriedKeyName";
52    /** Tag of Element CipherData **/
53    public static final String JavaDoc _TAG_CIPHERDATA = "CipherData";
54    /** Tag of Element CipherReference **/
55    public static final String JavaDoc _TAG_CIPHERREFERENCE = "CipherReference";
56    /** Tag of Element CipherValue **/
57    public static final String JavaDoc _TAG_CIPHERVALUE = "CipherValue";
58    /** Tag of Element DataReference **/
59    public static final String JavaDoc _TAG_DATAREFERENCE = "DataReference";
60    /** Tag of Element EncryptedData **/
61    public static final String JavaDoc _TAG_ENCRYPTEDDATA = "EncryptedData";
62    /** Tag of Element EncryptedKey **/
63    public static final String JavaDoc _TAG_ENCRYPTEDKEY = "EncryptedKey";
64    /** Tag of Element EncryptionMethod **/
65    public static final String JavaDoc _TAG_ENCRYPTIONMETHOD = "EncryptionMethod";
66    /** Tag of Element EncryptionProperties **/
67    public static final String JavaDoc _TAG_ENCRYPTIONPROPERTIES = "EncryptionProperties";
68    /** Tag of Element EncryptionProperty **/
69    public static final String JavaDoc _TAG_ENCRYPTIONPROPERTY = "EncryptionProperty";
70    /** Tag of Element KeyReference **/
71    public static final String JavaDoc _TAG_KEYREFERENCE = "KeyReference";
72    /** Tag of Element KeySize **/
73    public static final String JavaDoc _TAG_KEYSIZE = "KeySize";
74    /** Tag of Element OAEPparams **/
75    public static final String JavaDoc _TAG_OAEPPARAMS = "OAEPparams";
76    /** Tag of Element ReferenceList **/
77    public static final String JavaDoc _TAG_REFERENCELIST = "ReferenceList";
78    /** Tag of Element Transforms **/
79    public static final String JavaDoc _TAG_TRANSFORMS = "Transforms";
80    /** Tag of Element AgreementMethod **/
81    public static final String JavaDoc _TAG_AGREEMENTMETHOD = "AgreementMethod";
82    /** Tag of Element KA-Nonce **/
83    public static final String JavaDoc _TAG_KA_NONCE = "KA-Nonce";
84    /** Tag of Element OriginatorKeyInfo **/
85    public static final String JavaDoc _TAG_ORIGINATORKEYINFO = "OriginatorKeyInfo";
86    /** Tag of Element RecipientKeyInfo **/
87    public static final String JavaDoc _TAG_RECIPIENTKEYINFO = "RecipientKeyInfo";
88
89    /** Field ENCRYPTIONSPECIFICATION_URL */
90    public static final String JavaDoc ENCRYPTIONSPECIFICATION_URL = "http://www.w3.org/TR/2001/WD-xmlenc-core-20010626/";
91
92    /** The namespace of the <A HREF="http://www.w3.org/TR/2001/WD-xmlenc-core-20010626/">XML Encryption Syntax and Processing</A> */
93    public static final String JavaDoc EncryptionSpecNS = "http://www.w3.org/2001/04/xmlenc#";
94
95    /** URI for content*/
96    public static final String JavaDoc TYPE_CONTENT = EncryptionSpecNS + "Content";
97    /** URI for element*/
98    public static final String JavaDoc TYPE_ELEMENT = EncryptionSpecNS + "Element";
99    /** URI for mediatype*/
100    public static final String JavaDoc TYPE_MEDIATYPE = "http://www.isi.edu/in-notes/iana/assignments/media-types/"; // + "*/*";
101

102    /** Block Encryption - REQUIRED TRIPLEDES */
103    public static final String JavaDoc ALGO_ID_BLOCKCIPHER_TRIPLEDES = EncryptionConstants.EncryptionSpecNS + "tripledes-cbc";
104    /** Block Encryption - REQUIRED AES-128 */
105    public static final String JavaDoc ALGO_ID_BLOCKCIPHER_AES128 = EncryptionConstants.EncryptionSpecNS + "aes128-cbc";
106    /** Block Encryption - REQUIRED AES-256 */
107    public static final String JavaDoc ALGO_ID_BLOCKCIPHER_AES256 = EncryptionConstants.EncryptionSpecNS + "aes256-cbc";
108    /** Block Encryption - OPTIONAL AES-192 */
109    public static final String JavaDoc ALGO_ID_BLOCKCIPHER_AES192 = EncryptionConstants.EncryptionSpecNS + "aes192-cbc";
110
111    /** Key Transport - REQUIRED RSA-v1.5*/
112    public static final String JavaDoc ALGO_ID_KEYTRANSPORT_RSA15 = EncryptionConstants.EncryptionSpecNS + "rsa-1_5";
113    /** Key Transport - REQUIRED RSA-OAEP */
114    public static final String JavaDoc ALGO_ID_KEYTRANSPORT_RSAOAEP = EncryptionConstants.EncryptionSpecNS + "rsa-oaep-mgf1p";
115
116    /** Key Agreement - OPTIONAL Diffie-Hellman */
117    public static final String JavaDoc ALGO_ID_KEYAGREEMENT_DH = EncryptionConstants.EncryptionSpecNS + "dh";
118
119    /** Symmetric Key Wrap - REQUIRED TRIPLEDES KeyWrap */
120    public static final String JavaDoc ALGO_ID_KEYWRAP_TRIPLEDES = EncryptionConstants.EncryptionSpecNS + "kw-tripledes";
121    /** Symmetric Key Wrap - REQUIRED AES-128 KeyWrap */
122    public static final String JavaDoc ALGO_ID_KEYWRAP_AES128 = EncryptionConstants.EncryptionSpecNS + "kw-aes128";
123    /** Symmetric Key Wrap - REQUIRED AES-256 KeyWrap */
124    public static final String JavaDoc ALGO_ID_KEYWRAP_AES256 = EncryptionConstants.EncryptionSpecNS + "kw-aes256";
125    /** Symmetric Key Wrap - OPTIONAL AES-192 KeyWrap */
126    public static final String JavaDoc ALGO_ID_KEYWRAP_AES192 = EncryptionConstants.EncryptionSpecNS + "kw-aes192";
127
128    /*
129    // Message Digest - REQUIRED SHA1
130    public static final String ALGO_ID_DIGEST_SHA160 = Constants.ALGO_ID_DIGEST_SHA1;
131    // Message Digest - RECOMMENDED SHA256
132    public static final String ALGO_ID_DIGEST_SHA256 = EncryptionConstants.EncryptionSpecNS + "sha256";
133    // Message Digest - OPTIONAL SHA512
134    public static final String ALGO_ID_DIGEST_SHA512 = EncryptionConstants.EncryptionSpecNS + "sha512";
135    // Message Digest - OPTIONAL RIPEMD-160
136    public static final String ALGO_ID_DIGEST_RIPEMD160 = EncryptionConstants.EncryptionSpecNS + "ripemd160";
137    */

138
139    /** Message Authentication - RECOMMENDED XML Digital Signature */
140    public static final String JavaDoc ALGO_ID_AUTHENTICATION_XMLSIGNATURE = "http://www.w3.org/TR/2001/CR-xmldsig-core-20010419/";
141
142    /** Canonicalization - OPTIONAL Canonical XML with Comments */
143    public static final String JavaDoc ALGO_ID_C14N_WITHCOMMENTS = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
144    /** Canonicalization - OPTIONAL Canonical XML (omits comments) */
145    public static final String JavaDoc ALGO_ID_C14N_OMITCOMMENTS = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
146
147    /** Encoding - REQUIRED base64 */
148    public static final String JavaDoc ALGO_ID_ENCODING_BASE64 = "http://www.w3.org/2000/09/xmldsig#base64";
149    //J+
150

151    private EncryptionConstants() {
152      // we don't allow instantiation
153
}
154
155    /**
156     * Method setEncryptionSpecNSprefix
157     *
158     * @param newPrefix
159     * @throws XMLSecurityException
160     */

161    public static void setEncryptionSpecNSprefix(String JavaDoc newPrefix)
162            throws XMLSecurityException {
163       ElementProxy.setDefaultPrefix(EncryptionConstants.EncryptionSpecNS,
164                                     newPrefix);
165    }
166
167    /**
168     * Method getEncryptionSpecNSprefix
169     *
170     * @return the prefix for this node.
171     */

172    public static String JavaDoc getEncryptionSpecNSprefix() {
173       return ElementProxy
174          .getDefaultPrefix(EncryptionConstants.EncryptionSpecNS);
175    }
176 }
177
Popular Tags