blob: f4eff9b0f94ae3baa7a002f224bf2dc6dee5a648 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Copyright 1999-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 */
21package com.sun.org.apache.xml.internal.security.utils;
22
23
24
25import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
26
27
28/**
29 *
30 * @author $Author: raul $
31 */
32public class EncryptionConstants {
33 //J-
34 // Attributes that exist in XML Signature in the same way
35 /** Tag of Attr Algorithm **/
36 public static final String _ATT_ALGORITHM = Constants._ATT_ALGORITHM;
37 /** Tag of Attr Id**/
38 public static final String _ATT_ID = Constants._ATT_ID;
39 /** Tag of Attr Target **/
40 public static final String _ATT_TARGET = Constants._ATT_TARGET;
41 /** Tag of Attr Type **/
42 public static final String _ATT_TYPE = Constants._ATT_TYPE;
43 /** Tag of Attr URI **/
44 public static final String _ATT_URI = Constants._ATT_URI;
45
46 // Attributes new in XML Encryption
47 /** Tag of Attr encoding **/
48 public static final String _ATT_ENCODING = "Encoding";
49 /** Tag of Attr recipient **/
50 public static final String _ATT_RECIPIENT = "Recipient";
51 /** Tag of Attr mimetype **/
52 public static final String _ATT_MIMETYPE = "MimeType";
53
54 /** Tag of Element CarriedKeyName **/
55 public static final String _TAG_CARRIEDKEYNAME = "CarriedKeyName";
56 /** Tag of Element CipherData **/
57 public static final String _TAG_CIPHERDATA = "CipherData";
58 /** Tag of Element CipherReference **/
59 public static final String _TAG_CIPHERREFERENCE = "CipherReference";
60 /** Tag of Element CipherValue **/
61 public static final String _TAG_CIPHERVALUE = "CipherValue";
62 /** Tag of Element DataReference **/
63 public static final String _TAG_DATAREFERENCE = "DataReference";
64 /** Tag of Element EncryptedData **/
65 public static final String _TAG_ENCRYPTEDDATA = "EncryptedData";
66 /** Tag of Element EncryptedKey **/
67 public static final String _TAG_ENCRYPTEDKEY = "EncryptedKey";
68 /** Tag of Element EncryptionMethod **/
69 public static final String _TAG_ENCRYPTIONMETHOD = "EncryptionMethod";
70 /** Tag of Element EncryptionProperties **/
71 public static final String _TAG_ENCRYPTIONPROPERTIES = "EncryptionProperties";
72 /** Tag of Element EncryptionProperty **/
73 public static final String _TAG_ENCRYPTIONPROPERTY = "EncryptionProperty";
74 /** Tag of Element KeyReference **/
75 public static final String _TAG_KEYREFERENCE = "KeyReference";
76 /** Tag of Element KeySize **/
77 public static final String _TAG_KEYSIZE = "KeySize";
78 /** Tag of Element OAEPparams **/
79 public static final String _TAG_OAEPPARAMS = "OAEPparams";
80 /** Tag of Element ReferenceList **/
81 public static final String _TAG_REFERENCELIST = "ReferenceList";
82 /** Tag of Element Transforms **/
83 public static final String _TAG_TRANSFORMS = "Transforms";
84 /** Tag of Element AgreementMethod **/
85 public static final String _TAG_AGREEMENTMETHOD = "AgreementMethod";
86 /** Tag of Element KA-Nonce **/
87 public static final String _TAG_KA_NONCE = "KA-Nonce";
88 /** Tag of Element OriginatorKeyInfo **/
89 public static final String _TAG_ORIGINATORKEYINFO = "OriginatorKeyInfo";
90 /** Tag of Element RecipientKeyInfo **/
91 public static final String _TAG_RECIPIENTKEYINFO = "RecipientKeyInfo";
92
93 /** Field ENCRYPTIONSPECIFICATION_URL */
94 public static final String ENCRYPTIONSPECIFICATION_URL = "http://www.w3.org/TR/2001/WD-xmlenc-core-20010626/";
95
96 /** The namespace of the <A HREF="http://www.w3.org/TR/2001/WD-xmlenc-core-20010626/">XML Encryption Syntax and Processing</A> */
97 public static final String EncryptionSpecNS = "http://www.w3.org/2001/04/xmlenc#";
98
99 /** URI for content*/
100 public static final String TYPE_CONTENT = EncryptionSpecNS + "Content";
101 /** URI for element*/
102 public static final String TYPE_ELEMENT = EncryptionSpecNS + "Element";
103 /** URI for mediatype*/
104 public static final String TYPE_MEDIATYPE = "http://www.isi.edu/in-notes/iana/assignments/media-types/"; // + "*/*";
105
106 /** Block Encryption - REQUIRED TRIPLEDES */
107 public static final String ALGO_ID_BLOCKCIPHER_TRIPLEDES = EncryptionConstants.EncryptionSpecNS + "tripledes-cbc";
108 /** Block Encryption - REQUIRED AES-128 */
109 public static final String ALGO_ID_BLOCKCIPHER_AES128 = EncryptionConstants.EncryptionSpecNS + "aes128-cbc";
110 /** Block Encryption - REQUIRED AES-256 */
111 public static final String ALGO_ID_BLOCKCIPHER_AES256 = EncryptionConstants.EncryptionSpecNS + "aes256-cbc";
112 /** Block Encryption - OPTIONAL AES-192 */
113 public static final String ALGO_ID_BLOCKCIPHER_AES192 = EncryptionConstants.EncryptionSpecNS + "aes192-cbc";
114
115 /** Key Transport - REQUIRED RSA-v1.5*/
116 public static final String ALGO_ID_KEYTRANSPORT_RSA15 = EncryptionConstants.EncryptionSpecNS + "rsa-1_5";
117 /** Key Transport - REQUIRED RSA-OAEP */
118 public static final String ALGO_ID_KEYTRANSPORT_RSAOAEP = EncryptionConstants.EncryptionSpecNS + "rsa-oaep-mgf1p";
119
120 /** Key Agreement - OPTIONAL Diffie-Hellman */
121 public static final String ALGO_ID_KEYAGREEMENT_DH = EncryptionConstants.EncryptionSpecNS + "dh";
122
123 /** Symmetric Key Wrap - REQUIRED TRIPLEDES KeyWrap */
124 public static final String ALGO_ID_KEYWRAP_TRIPLEDES = EncryptionConstants.EncryptionSpecNS + "kw-tripledes";
125 /** Symmetric Key Wrap - REQUIRED AES-128 KeyWrap */
126 public static final String ALGO_ID_KEYWRAP_AES128 = EncryptionConstants.EncryptionSpecNS + "kw-aes128";
127 /** Symmetric Key Wrap - REQUIRED AES-256 KeyWrap */
128 public static final String ALGO_ID_KEYWRAP_AES256 = EncryptionConstants.EncryptionSpecNS + "kw-aes256";
129 /** Symmetric Key Wrap - OPTIONAL AES-192 KeyWrap */
130 public static final String ALGO_ID_KEYWRAP_AES192 = EncryptionConstants.EncryptionSpecNS + "kw-aes192";
131
132 /*
133 // Message Digest - REQUIRED SHA1
134 public static final String ALGO_ID_DIGEST_SHA160 = Constants.ALGO_ID_DIGEST_SHA1;
135 // Message Digest - RECOMMENDED SHA256
136 public static final String ALGO_ID_DIGEST_SHA256 = EncryptionConstants.EncryptionSpecNS + "sha256";
137 // Message Digest - OPTIONAL SHA512
138 public static final String ALGO_ID_DIGEST_SHA512 = EncryptionConstants.EncryptionSpecNS + "sha512";
139 // Message Digest - OPTIONAL RIPEMD-160
140 public static final String ALGO_ID_DIGEST_RIPEMD160 = EncryptionConstants.EncryptionSpecNS + "ripemd160";
141 */
142
143 /** Message Authentication - RECOMMENDED XML Digital Signature */
144 public static final String ALGO_ID_AUTHENTICATION_XMLSIGNATURE = "http://www.w3.org/TR/2001/CR-xmldsig-core-20010419/";
145
146 /** Canonicalization - OPTIONAL Canonical XML with Comments */
147 public static final String ALGO_ID_C14N_WITHCOMMENTS = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
148 /** Canonicalization - OPTIONAL Canonical XML (omits comments) */
149 public static final String ALGO_ID_C14N_OMITCOMMENTS = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
150
151 /** Encoding - REQUIRED base64 */
152 public static final String ALGO_ID_ENCODING_BASE64 = "http://www.w3.org/2000/09/xmldsig#base64";
153 //J+
154
155 private EncryptionConstants() {
156 // we don't allow instantiation
157 }
158
159 /**
160 * Method setEncryptionSpecNSprefix
161 *
162 * @param newPrefix
163 * @throws XMLSecurityException
164 */
165 public static void setEncryptionSpecNSprefix(String newPrefix)
166 throws XMLSecurityException {
167 ElementProxy.setDefaultPrefix(EncryptionConstants.EncryptionSpecNS,
168 newPrefix);
169 }
170
171 /**
172 * Method getEncryptionSpecNSprefix
173 *
174 * @return the prefix for this node.
175 */
176 public static String getEncryptionSpecNSprefix() {
177 return ElementProxy
178 .getDefaultPrefix(EncryptionConstants.EncryptionSpecNS);
179 }
180}