Source Code Cross Referenced for CertPathBuilder.java in  » Apache-Harmony-Java-SE » java-package » java » security » cert » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.security.cert 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        /**
019:         * @author Vera Y. Petrashkova
020:         * @version $Revision$
021:         */package java.security.cert;
022:
023:        import java.security.AccessController;
024:        import java.security.InvalidAlgorithmParameterException;
025:        import java.security.NoSuchAlgorithmException;
026:        import java.security.NoSuchProviderException;
027:        import java.security.Provider;
028:        import java.security.Security;
029:
030:        import org.apache.harmony.security.fortress.Engine;
031:        import org.apache.harmony.security.internal.nls.Messages;
032:
033:        /**
034:         * @com.intel.drl.spec_ref
035:         * 
036:         */
037:
038:        public class CertPathBuilder {
039:
040:            // Store CertPathBuilder service name
041:            private static final String SERVICE = "CertPathBuilder"; //$NON-NLS-1$
042:
043:            // Used to access common engine functionality
044:            private static Engine engine = new Engine(SERVICE);
045:
046:            // Store default property name
047:            private static final String PROPERTYNAME = "certpathbuilder.type"; //$NON-NLS-1$
048:
049:            // Default value of CertPathBuilder type. It returns if certpathbuild.type
050:            // property is not defined in java.security file
051:            private static final String DEFAULTPROPERTY = "PKIX"; //$NON-NLS-1$
052:
053:            // Store used provider
054:            private final Provider provider;
055:
056:            // Store spi implementation
057:            private CertPathBuilderSpi spiImpl;
058:
059:            // Store algorithm name
060:            private final String algorithm;
061:
062:            /**
063:             * @com.intel.drl.spec_ref
064:             */
065:            protected CertPathBuilder(CertPathBuilderSpi builderSpi,
066:                    Provider provider, String algorithm) {
067:                this .provider = provider;
068:                this .algorithm = algorithm;
069:                this .spiImpl = builderSpi;
070:            }
071:
072:            /**
073:             * @com.intel.drl.spec_ref
074:             */
075:            public final String getAlgorithm() {
076:                return algorithm;
077:            }
078:
079:            /**
080:             * @com.intel.drl.spec_ref
081:             */
082:            public final Provider getProvider() {
083:                return provider;
084:            }
085:
086:            /**
087:             * @com.intel.drl.spec_ref
088:             * 
089:             * throws NullPointerException if algorithm is null (instead of
090:             * NoSuchAlgorithmException as in 1.4 release)
091:             */
092:            public static CertPathBuilder getInstance(String algorithm)
093:                    throws NoSuchAlgorithmException {
094:                if (algorithm == null) {
095:                    throw new NullPointerException(Messages
096:                            .getString("security.01")); //$NON-NLS-1$
097:                }
098:                synchronized (engine) {
099:                    engine.getInstance(algorithm, null);
100:                    return new CertPathBuilder((CertPathBuilderSpi) engine.spi,
101:                            engine.provider, algorithm);
102:                }
103:            }
104:
105:            /**
106:             * @com.intel.drl.spec_ref
107:             * 
108:             * throws NullPointerException if algorithm is null (instead of
109:             * NoSuchAlgorithmException as in 1.4 release)
110:             * 
111:             * FIXME: jrockit-j2re1.4.2_04 throws IllegalArgumentException when provider
112:             * is empty
113:             */
114:            public static CertPathBuilder getInstance(String algorithm,
115:                    String provider) throws NoSuchAlgorithmException,
116:                    NoSuchProviderException {
117:                if ((provider == null) || (provider.length() == 0)) {
118:                    throw new IllegalArgumentException(Messages
119:                            .getString("security.02")); //$NON-NLS-1$
120:                }
121:                Provider impProvider = Security.getProvider(provider);
122:                if (impProvider == null) {
123:                    throw new NoSuchProviderException(provider);
124:                }
125:                return getInstance(algorithm, impProvider);
126:
127:            }
128:
129:            /**
130:             * @com.intel.drl.spec_ref
131:             * 
132:             * throws NullPointerException if algorithm is null (instead of
133:             * NoSuchAlgorithmException as in 1.4 release)
134:             */
135:            public static CertPathBuilder getInstance(String algorithm,
136:                    Provider provider) throws NoSuchAlgorithmException {
137:                if (provider == null) {
138:                    throw new IllegalArgumentException(Messages
139:                            .getString("security.04")); //$NON-NLS-1$
140:                }
141:                if (algorithm == null) {
142:                    throw new NullPointerException(Messages
143:                            .getString("security.01")); //$NON-NLS-1$
144:                }
145:                synchronized (engine) {
146:                    engine.getInstance(algorithm, provider, null);
147:                    return new CertPathBuilder((CertPathBuilderSpi) engine.spi,
148:                            provider, algorithm);
149:                }
150:            }
151:
152:            /**
153:             * @com.intel.drl.spec_ref
154:             */
155:            public final CertPathBuilderResult build(CertPathParameters params)
156:                    throws CertPathBuilderException,
157:                    InvalidAlgorithmParameterException {
158:                return spiImpl.engineBuild(params);
159:            }
160:
161:            /**
162:             * @com.intel.drl.spec_ref
163:             */
164:            public static final String getDefaultType() {
165:                String defaultType = AccessController
166:                        .doPrivileged(new java.security.PrivilegedAction<String>() {
167:                            public String run() {
168:                                return Security.getProperty(PROPERTYNAME);
169:                            }
170:                        });
171:                return (defaultType != null ? defaultType : DEFAULTPROPERTY);
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.