Source Code Cross Referenced for Main.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » tools » keytool » 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 » org package » org.apache.harmony.tools.keytool 
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, WITHOUT
013:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014:         * License for the specific language governing permissions and limitations under
015:         * the License.
016:         */
017:
018:        package org.apache.harmony.tools.keytool;
019:
020:        /**
021:         * The main class that bundles command line parsing, interaction with the user
022:         * and work with keys and certificates.
023:         *
024:         * Class that implements the functionality of the key and certificate management
025:         * tool.
026:         */
027:        public class Main {
028:
029:            /**
030:             * Does the actual work with keys and certificates, based on the parameter
031:             * param. If something goes wrong an exception is thrown.
032:             */
033:            static void doWork(KeytoolParameters param) throws Exception {
034:                switch (param.getCommand()) {
035:                case EXPORT:
036:                    CertExporter.exportCert(param);
037:                    break;
038:                case LIST:
039:                    KeyStoreCertPrinter.list(param);
040:                    break;
041:                case PRINTCERT:
042:                    KeyStoreCertPrinter.printCert(param);
043:                    break;
044:                case KEYCLONE:
045:                    EntryManager.keyClone(param);
046:                    break;
047:                case DELETE:
048:                    EntryManager.delete(param);
049:                    break;
050:                case STOREPASSWD:
051:                    KeytoolKSLoaderSaver.storePasswd(param);
052:                    break;
053:                case KEYPASSWD:
054:                    EntryManager.keyPasswd(param);
055:                    break;
056:                case IMPORT:
057:                    CertImporter.importCert(param);
058:                    break;
059:                case CHECK:
060:                    CRLManager.checkRevoked(param);
061:                    break;
062:                case VERIFY:
063:                    CertChainVerifier.verifyChain(param);
064:                    break;
065:                case CERTREQ:
066:                    CSRGenerator.certReq(param);
067:                    break;
068:                case HELP:
069:                    if (param.getHelpTopic() != null) {
070:                        HelpPrinter.topicHelp(param.getHelpTopic());
071:                    } else {
072:                        HelpPrinter.printHelp();
073:                    }
074:                    break;
075:                case GENKEY:
076:                    KeyCertGenerator.genKey(param);
077:                    break;
078:                case SELFCERT:
079:                    KeyCertGenerator.selfCert(param);
080:                    break;
081:                case CONVERT:
082:                    KeyStoreConverter.convertKeyStore(param);
083:                    break;
084:                }
085:            }
086:
087:            /**
088:             * The main method to run from another program.
089:             * 
090:             * @param args -
091:             *            command line with options.
092:             */
093:            public static void run(String[] args) throws Exception {
094:                KeytoolParameters param = ArgumentsParser.parseArgs(args);
095:
096:                if (param == null) {
097:                    HelpPrinter.printHelp();
098:                    System.exit(-1);
099:                }
100:
101:                Command command = param.getCommand();
102:
103:                // all commands except printcert and help work with a store
104:                if (command != Command.PRINTCERT && command != Command.HELP) {
105:                    // all commands that work with store except list and export
106:                    // need store password to with keystore.
107:                    if (param.getStorePass() == null && command != Command.LIST
108:                            && command != Command.EXPORT) {
109:                        throw new KeytoolException(
110:                                "Must specify store password to work with this command.");
111:                    }
112:                    // prompt for additional parameters if some of the expected
113:                    // ones have not been specified.
114:                    ArgumentsParser.getAdditionalParameters(param);
115:
116:                    // print the warning if store password is not set
117:                    if (param.getStorePass() == null) {
118:                        System.out
119:                                .println("\nWARNING!!!\nThe integrity "
120:                                        + "of the keystore data has NOT been checked!\n"
121:                                        + "To check it you must provide"
122:                                        + " your keystore password!\n");
123:                    }
124:                }
125:
126:                // the work is being done here
127:                doWork(param);
128:
129:                if (param.isNeedSaveKS()) {
130:                    // save the store
131:                    KeytoolKSLoaderSaver.saveStore(param);
132:                }
133:            }
134:
135:            /**
136:             * The main method to run from command line.
137:             * 
138:             * @param args -
139:             *            command line with options.
140:             */
141:            public static void main(String[] args) {
142:                try {
143:                    run(args);
144:                } catch (Exception e) {
145:                    // System.out.println("Keytool error: " + e);
146:                    e.printStackTrace();
147:                }
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.