Source Code Cross Referenced for SRAPNSSInit.java in  » Portal » Open-Portal » com » sun » portal » rproxy » https » 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 » Portal » Open Portal » com.sun.portal.rproxy.https 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SRAPNSSInit.java,v 1.11 2005/11/30 11:27:28 ss150821 Exp $
003:         * $Source: /m/portal/ps/srap/src/com/sun/portal/rproxy/https/SRAPNSSInit.java,v $
004:         * $Log: SRAPNSSInit.java,v $
005:         * Revision 1.11  2005/11/30 11:27:28  ss150821
006:         * 6356996 - Srap Code base needs to save files in the unix file format and not windows
007:         *
008:         * Revision 1.10  2005/06/14 11:06:23  ak118254
009:         * 6281362 6281288 6281393 SUNWps to SUNWportal change.
010:         *
011:         * Revision 1.9  2005/02/25 09:44:17  ss150821
012:         * RFE 6223490 - SRA Should use JDK based logging, changed to start throwing the full stacktrace for the  exception in the logs
013:         *
014:         * Revision 1.8  2005/02/23 09:02:02  ss150821
015:         * RFE 6223490 - SRA Should use JDK based logging
016:         *
017:         * Revision 1.7  2005/02/23 08:59:23  ss150821
018:         * RFE 6223490 - SRA Should use JDK based logging
019:         *
020:         * Revision 1.6  2004/07/27 12:58:29  vt126379
021:         * RFE#5075809, CRT#99
022:         *
023:         * Revision 1.5  2003/08/04 09:21:11  ss133690
024:         * Bug: 4882883, encryption framework, changed the Password.java
025:         *
026:         * Revision 1.4  2003/07/30 07:00:43  ss133690
027:         * hash verification added to encryption framework
028:         *
029:         * Revision 1.3  2003/03/14 06:48:07  ss133690
030:         * Bug 4777418 handle encrypted jss password
031:         *
032:         * Revision 1.2  2003/01/30 11:46:28  bv131302
033:         * removing /etc/opt/SUNWportal dependencies - win2k port
034:         *
035:         * Revision 1.1  2002/06/14 09:53:58  rt130506
036:         * SRAP rebranding
037:         *
038:         * Revision 1.4  2002/06/12 07:55:59  bv131302
039:         * more rebranding - filenames
040:         *
041:         * Revision 1.3  2002/06/11 16:59:03  bv131302
042:         * SUNWips changes
043:         *
044:         * Revision 1.2  2002/06/11 16:02:09  bv131302
045:         * new branded
046:         *
047:         * Revision 1.1  2002/05/28 09:38:19  mm132998
048:         * Bug id - 4692062 , CRT - 1215 , Desc - Support for iDSAME in https mode.
049:         *
050:         *
051:         */
052:        package com.sun.portal.rproxy.https;
053:
054:        import java.io.BufferedReader;
055:        import java.io.File;
056:        import java.io.FileInputStream;
057:        import java.io.InputStreamReader;
058:        import java.util.logging.Level;
059:        import java.util.logging.Logger;
060:
061:        import org.mozilla.jss.CertDatabaseException;
062:        import org.mozilla.jss.CryptoManager;
063:        import org.mozilla.jss.KeyDatabaseException;
064:
065:        import com.sun.portal.cli.cert.JSSUtil;
066:        import com.sun.portal.cli.cert.SRADecoderException;
067:        import com.sun.portal.log.common.PortalLogger;
068:
069:        public class SRAPNSSInit {
070:            public static String nickname = "server-cert";
071:
072:            // private static Logger logger =
073:            // Logger.getLogger("com.sun.portal.sra.rproxy");
074:            private static Logger logger = PortalLogger
075:                    .getLogger(SRAPNSSInit.class);
076:
077:            public static boolean initialize() {
078:                /*
079:                 * Changes for JSS3.1.1
080:                 */
081:                /* if (!NSSInit.isInitialized()) { */
082:                // End of code change for JSS3.1.1
083:                String jssPassword;
084:                String certdbDir;
085:                String pwfile;
086:                String nicknamefile;
087:
088:                certdbDir = System.getProperty("gateway.keybase", System
089:                        .getProperty("SRAP_CONFIG_DIR", "/etc/opt/SUNWportal"));
090:                // logger.info("SRAPNSSInit: certdbDir = " + certdbDir);
091:                Object[] params0 = { certdbDir };
092:                logger.log(Level.INFO, "PSSRRPROXY_CSPRH026", params0);
093:                try {
094:                    JSSUtil.setDefaultDecoder(certdbDir);
095:                } catch (SRADecoderException ex) {
096:                    // logger.severe("SRAPNSSInit: Unable to initialize the password
097:                    // encryption module : "+ex.getMessage());
098:                    Object[] params1 = { ex.getMessage() };
099:                    logger.log(Level.SEVERE, "PSSRRPROXY_CSPRH027", params1);
100:                }
101:
102:                nicknamefile = System.getProperty("gateway.nickname", System
103:                        .getProperty("SRAP_CONFIG_DIR", "/etc/opt/SUNWportal")
104:                        + File.separatorChar
105:                        + "cert"
106:                        + File.separatorChar
107:                        + ".nickname");
108:                // logger.info("SRAPNSSInit: nicknamefile = " +nicknamefile);
109:                Object[] params2 = { nicknamefile };
110:                logger.log(Level.INFO, "PSSRRPROXY_CSPRH028", params2);
111:
112:                if (nicknamefile != null) {
113:                    try {
114:                        FileInputStream fis = new FileInputStream(nicknamefile);
115:                        InputStreamReader isr = new InputStreamReader(fis);
116:                        BufferedReader br = new BufferedReader(isr);
117:                        nickname = br.readLine();
118:                    } catch (Exception ex) {
119:                        // logger.info("SRAPNSSInit: Unable to read jss nickname from
120:                        // file " + nicknamefile);
121:                        Object[] params3 = { nicknamefile };
122:                        logger.log(Level.INFO, "PSSRRPROXY_CSPRH029", params3);
123:                    }
124:                } else {
125:                    // logger.info("SRAPNSSInit: Unable to get nickname file name");
126:                    logger.info("PSSRRPROXY_CSPRH030");
127:                }
128:
129:                pwfile = System.getProperty("gateway.pass", System.getProperty(
130:                        "SRAP_CONFIG_DIR", "/etc/opt/SUNWportal")
131:                        + File.separatorChar
132:                        + "cert"
133:                        + File.separatorChar
134:                        + ".jsspass");
135:                // logger.info("SRAPNSSInit: pwfile = " + pwfile);
136:                Object[] params5 = { pwfile };
137:                logger.log(Level.INFO, "PSSRRPROXY_CSPRH031", params5);
138:
139:                if (pwfile != null) {
140:                    try {
141:                        FileInputStream fis = new FileInputStream(pwfile);
142:                        InputStreamReader isr = new InputStreamReader(fis);
143:                        BufferedReader br = new BufferedReader(isr);
144:                        jssPassword = br.readLine();
145:                        com.sun.portal.cli.cert.Password pass = JSSUtil
146:                                .decryptPassword(jssPassword);
147:                        jssPassword = pass.getPassword();
148:                        if (pass.isEncrypted()) {
149:                            // logger.info("SRAPNSSInit: Found encrypted password");
150:                            logger.info("PSSRRPROXY_CSPRH032");
151:                        }
152:
153:                    } catch (Exception ex) {
154:                        return false;
155:                    }
156:                } else {
157:                    return false;
158:                }
159:
160:                try {
161:                    /*
162:                     * Changes for JSS3.1.1
163:                     */
164:                    /*
165:                     * NSSInit.initialize(certdbDir + "/secmod.db", certdbDir +
166:                     * "/key3.db", certdbDir + "/cert7.db");
167:                     * NSSInit.setPasswordCallback(new
168:                     * CertAdminPasswordCallback(jssPassword));
169:                     */
170:                    CryptoManager.InitializationValues vals = new CryptoManager.InitializationValues(
171:                            certdbDir);
172:                    CryptoManager.initialize(vals);
173:                    CryptoManager.getInstance().setPasswordCallback(
174:                            new SRAPPasswordCallback(jssPassword));
175:                    // End of cod echange for JSS3.1.1
176:
177:                } catch (KeyDatabaseException kdbe) {
178:                    // logger.log(Level.SEVERE, "SRAPNSSInit: Couldn't open the key
179:                    // database." + kdbe);
180:                    logger.log(Level.SEVERE, "PSSRRPROXY_CSPRH033", kdbe);
181:                    return false;
182:                } catch (CertDatabaseException cdbe) {
183:                    // logger.log(Level.SEVERE, "SRAPNSSInit: Couldn't open the
184:                    // certificate database." + cdbe);
185:                    logger.log(Level.SEVERE, "PSSRRPROXY_CSPRH034", cdbe);
186:
187:                    return false;
188:                } catch (org.mozilla.jss.crypto.AlreadyInitializedException aie) {
189:                    // logger.severe("SRAPNSSInit: CryptoManager already initialized." +
190:                    // aie);
191:                    logger.log(Level.SEVERE, "PSSRRPROXY_CSPRH035", aie);
192:                } catch (Exception e) {
193:                    // logger.severe("SRAPNSSInit: Exception occurred:
194:                    // "+e.getMessage());
195:                    logger.log(Level.SEVERE, "PSSRRPROXY_CSPRH036", e);
196:                    return false;
197:                }
198:                /*
199:                 * Changes for JSS3.1.1
200:                 */
201:                // }
202:                // End of code change for JSS3.1.1
203:                return true;
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.