KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Provides all constants and some translation functions for i18n.
26  *
27  * For the used Algorithm identifiers and Namespaces, look at the
28  * <A HREF="http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg">XML
29  * Signature specification</A>.
30  *
31  * @author $Author: raul $
32  */

33 public class Constants {
34
35    /** {@link java.util.logging} logging facility */
36    static java.util.logging.Logger JavaDoc log =
37         java.util.logging.Logger.getLogger(Constants.class.getName());
38
39    /** Field configurationFile */
40    public static final String JavaDoc configurationFile = "data/websig.conf";
41
42    /** Field configurationFileNew */
43    public static final String JavaDoc configurationFileNew = ".xmlsecurityconfig";
44
45    /** Field exceptionMessagesResourceBundleDir */
46    public static final String JavaDoc exceptionMessagesResourceBundleDir =
47       "com/sun/org/apache/xml/internal/security/resource";
48
49    /** Field exceptionMessagesResourceBundleBase is the location of the <CODE>ResourceBundle</CODE> */
50    public static final String JavaDoc exceptionMessagesResourceBundleBase =
51       exceptionMessagesResourceBundleDir + "/" + "xmlsecurity";
52    //J-
53
/**
54     * The URL of the <A HREF="http://www.w3.org/TR/2001/CR-xmldsig-core-20010419/">XML Signature specification</A>
55     */

56    public static final String JavaDoc SIGNATURESPECIFICATION_URL = "http://www.w3.org/TR/2001/CR-xmldsig-core-20010419/";
57
58    /**
59     * The namespace of the <A HREF="http://www.w3.org/TR/2001/CR-xmldsig-core-20010419/">XML Signature specification</A>
60     */

61    public static final String JavaDoc SignatureSpecNS = "http://www.w3.org/2000/09/xmldsig#";
62    /** The URL for more algorithm **/
63    public static final String JavaDoc MoreAlgorithmsSpecNS = "http://www.w3.org/2001/04/xmldsig-more#";
64    /** The URI for XML spec*/
65    public static final String JavaDoc XML_LANG_SPACE_SpecNS = "http://www.w3.org/XML/1998/namespace";
66    /** The URI for XMLNS spec*/
67    public static final String JavaDoc NamespaceSpecNS = "http://www.w3.org/2000/xmlns/";
68
69    /** Tag of Attr Algorithm**/
70    public static final String JavaDoc _ATT_ALGORITHM = "Algorithm";
71    /** Tag of Attr URI**/
72    public static final String JavaDoc _ATT_URI = "URI";
73    /** Tag of Attr Type**/
74    public static final String JavaDoc _ATT_TYPE = "Type";
75    /** Tag of Attr Id**/
76    public static final String JavaDoc _ATT_ID = "Id";
77    /** Tag of Attr MimeType**/
78    public static final String JavaDoc _ATT_MIMETYPE = "MimeType";
79    /** Tag of Attr Encoding**/
80    public static final String JavaDoc _ATT_ENCODING = "Encoding";
81    /** Tag of Attr Target**/
82    public static final String JavaDoc _ATT_TARGET = "Target";
83
84    // KeyInfo (KeyName|KeyValue|RetrievalMethod|X509Data|PGPData|SPKIData|MgmtData)
85
// KeyValue (DSAKeyValue|RSAKeyValue)
86
// DSAKeyValue (P, Q, G, Y, J?, (Seed, PgenCounter)?)
87
// RSAKeyValue (Modulus, Exponent)
88
// RetrievalMethod (Transforms?)
89
// X509Data ((X509IssuerSerial | X509SKI | X509SubjectName | X509Certificate)+ | X509CRL)
90
// X509IssuerSerial (X509IssuerName, X509SerialNumber)
91
// PGPData ((PGPKeyID, PGPKeyPacket?) | (PGPKeyPacket))
92
// SPKIData (SPKISexp)
93

94    /** Tag of Element CanonicalizationMethod **/
95    public static final String JavaDoc _TAG_CANONICALIZATIONMETHOD = "CanonicalizationMethod";
96    /** Tag of Element DigestMethod **/
97    public static final String JavaDoc _TAG_DIGESTMETHOD = "DigestMethod";
98    /** Tag of Element DigestValue **/
99    public static final String JavaDoc _TAG_DIGESTVALUE = "DigestValue";
100    /** Tag of Element Manifest **/
101    public static final String JavaDoc _TAG_MANIFEST = "Manifest";
102    /** Tag of Element Methods **/
103    public static final String JavaDoc _TAG_METHODS = "Methods";
104    /** Tag of Element Object **/
105    public static final String JavaDoc _TAG_OBJECT = "Object";
106    /** Tag of Element Reference **/
107    public static final String JavaDoc _TAG_REFERENCE = "Reference";
108    /** Tag of Element Signature **/
109    public static final String JavaDoc _TAG_SIGNATURE = "Signature";
110    /** Tag of Element SignatureMethod **/
111    public static final String JavaDoc _TAG_SIGNATUREMETHOD = "SignatureMethod";
112    /** Tag of Element HMACOutputLength **/
113    public static final String JavaDoc _TAG_HMACOUTPUTLENGTH = "HMACOutputLength";
114    /** Tag of Element SignatureProperties **/
115    public static final String JavaDoc _TAG_SIGNATUREPROPERTIES = "SignatureProperties";
116    /** Tag of Element SignatureProperty **/
117    public static final String JavaDoc _TAG_SIGNATUREPROPERTY = "SignatureProperty";
118    /** Tag of Element SignatureValue **/
119    public static final String JavaDoc _TAG_SIGNATUREVALUE = "SignatureValue";
120    /** Tag of Element SignedInfo **/
121    public static final String JavaDoc _TAG_SIGNEDINFO = "SignedInfo";
122    /** Tag of Element Transform **/
123    public static final String JavaDoc _TAG_TRANSFORM = "Transform";
124    /** Tag of Element Transforms **/
125    public static final String JavaDoc _TAG_TRANSFORMS = "Transforms";
126    /** Tag of Element XPath **/
127    public static final String JavaDoc _TAG_XPATH = "XPath";
128    /** Tag of Element KeyInfo **/
129    public static final String JavaDoc _TAG_KEYINFO = "KeyInfo";
130    /** Tag of Element KeyName **/
131    public static final String JavaDoc _TAG_KEYNAME = "KeyName";
132    /** Tag of Element KeyValue **/
133    public static final String JavaDoc _TAG_KEYVALUE = "KeyValue";
134    /** Tag of Element RetrievalMethod **/
135    public static final String JavaDoc _TAG_RETRIEVALMETHOD = "RetrievalMethod";
136    /** Tag of Element X509Data **/
137    public static final String JavaDoc _TAG_X509DATA = "X509Data";
138    /** Tag of Element PGPData **/
139    public static final String JavaDoc _TAG_PGPDATA = "PGPData";
140    /** Tag of Element SPKIData **/
141    public static final String JavaDoc _TAG_SPKIDATA = "SPKIData";
142    /** Tag of Element MgmtData **/
143    public static final String JavaDoc _TAG_MGMTDATA = "MgmtData";
144    /** Tag of Element RSAKeyValue **/
145    public static final String JavaDoc _TAG_RSAKEYVALUE = "RSAKeyValue";
146    /** Tag of Element Exponent **/
147    public static final String JavaDoc _TAG_EXPONENT = "Exponent";
148    /** Tag of Element Modulus **/
149    public static final String JavaDoc _TAG_MODULUS = "Modulus";
150    /** Tag of Element DSAKeyValue **/
151    public static final String JavaDoc _TAG_DSAKEYVALUE = "DSAKeyValue";
152    /** Tag of Element P **/
153    public static final String JavaDoc _TAG_P = "P";
154    /** Tag of Element Q **/
155    public static final String JavaDoc _TAG_Q = "Q";
156    /** Tag of Element G **/
157    public static final String JavaDoc _TAG_G = "G";
158    /** Tag of Element Y **/
159    public static final String JavaDoc _TAG_Y = "Y";
160    /** Tag of Element J **/
161    public static final String JavaDoc _TAG_J = "J";
162    /** Tag of Element Seed **/
163    public static final String JavaDoc _TAG_SEED = "Seed";
164    /** Tag of Element PgenCounter **/
165    public static final String JavaDoc _TAG_PGENCOUNTER = "PgenCounter";
166    /** Tag of Element rawX509Certificate **/
167    public static final String JavaDoc _TAG_RAWX509CERTIFICATE = "rawX509Certificate";
168    /** Tag of Element X509IssuerSerial **/
169    public static final String JavaDoc _TAG_X509ISSUERSERIAL = "X509IssuerSerial";
170    /** Tag of Element X509SKI **/
171    public static final String JavaDoc _TAG_X509SKI = "X509SKI";
172    /** Tag of Element X509SubjectName **/
173    public static final String JavaDoc _TAG_X509SUBJECTNAME = "X509SubjectName";
174    /** Tag of Element X509Certificate **/
175    public static final String JavaDoc _TAG_X509CERTIFICATE = "X509Certificate";
176    /** Tag of Element X509CRL **/
177    public static final String JavaDoc _TAG_X509CRL = "X509CRL";
178    /** Tag of Element X509IssuerName **/
179    public static final String JavaDoc _TAG_X509ISSUERNAME = "X509IssuerName";
180    /** Tag of Element X509SerialNumber **/
181    public static final String JavaDoc _TAG_X509SERIALNUMBER = "X509SerialNumber";
182    /** Tag of Element PGPKeyID **/
183    public static final String JavaDoc _TAG_PGPKEYID = "PGPKeyID";
184    /** Tag of Element PGPKeyPacket **/
185    public static final String JavaDoc _TAG_PGPKEYPACKET = "PGPKeyPacket";
186    /** Tag of Element SPKISexp **/
187    public static final String JavaDoc _TAG_SPKISEXP = "SPKISexp";
188
189    /** Digest - Required SHA1 */
190    public static final String JavaDoc ALGO_ID_DIGEST_SHA1 = SignatureSpecNS + "sha1";
191
192    /**
193     * @see <A HREF="http://www.ietf.org/internet-drafts/draft-blake-wilson-xmldsig-ecdsa-02.txt">
194     * draft-blake-wilson-xmldsig-ecdsa-02.txt</A>
195     */

196    public static final String JavaDoc ALGO_ID_SIGNATURE_ECDSA_CERTICOM = "http://www.certicom.com/2000/11/xmlecdsig#ecdsa-sha1";
197    //J+
198

199    private Constants() {
200      // we don't allow instantiation
201
}
202
203    /**
204     * Sets the namespace prefix which will be used to identify elements in the
205     * XML Signature Namespace.
206     *
207     * <pre>
208     * Constants.setSignatureSpecNSprefix("dsig");
209     * </pre>
210     *
211     * @param newPrefix is the new namespace prefix.
212     * @throws XMLSecurityException
213     * @see com.sun.org.apache.xml.internal.security.utils.Constants#getSignatureSpecNSprefix
214     * $todo$ Add consistency checking for valid prefix
215     */

216    public static void setSignatureSpecNSprefix(String JavaDoc newPrefix) throws XMLSecurityException {
217       ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, newPrefix);
218    }
219
220    /**
221     * Returns the XML namespace prefix which is used for elements in the XML
222     * Signature namespace.
223     *
224     * It is defaulted to <code>dsig</code>, but can be changed using the
225     * {@link #setSignatureSpecNSprefix} function.
226     *
227     * @return the current used namespace prefix
228     * @see #setSignatureSpecNSprefix
229     */

230    public static String JavaDoc getSignatureSpecNSprefix() {
231       return ElementProxy.getDefaultPrefix(Constants.SignatureSpecNS);
232    }
233 }
234
Popular Tags