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


001:        /*
002:         * PasswordContextImpl.java
003:         *
004:         */
005:
006:        /**
007:         *
008:         * @author ss133690 
009:         *  @version 
010:         */package com.sun.portal.cli.cert;
011:
012:        import org.mozilla.jss.crypto.*;
013:        import com.sun.portal.log.common.PortalLogger;
014:        import org.mozilla.jss.*;
015:
016:        public class PasswordContextImpl implements  PasswordContext {
017:            public String generatePassphrase(JSSContext cntx) {
018:                /**
019:                 * If the .jsspass file exists and returns the .jsspass password.
020:                 *If not it will create the .jsspass file with the new password.
021:                 *
022:                 */
023:                String passphrase = "";
024:                boolean flag = true;
025:                if (!cntx.isDBFileExist() || !cntx.isPassFileExist()) {
026:
027:                    while (flag) {
028:                        CertAdminUtil.println(CertAdminHelpText
029:                                .getPassphraseHelpText());
030:                        //passphrase = CertAdminUtil.questionMasked("Enter passphrase []");
031:                        passphrase = CertAdminUtil
032:                                .questionMasked(CertAdminLocale.getPFString(
033:                                        "q20", CertAdminConstants.q20));
034:                        while (passphrase.trim().equals("")) {
035:                            //println("Passphrase cannot be blank.");
036:                            CertAdminUtil.println(CertAdminLocale.getPFString(
037:                                    "m40", CertAdminConstants.m40));
038:                            passphrase = CertAdminUtil
039:                                    .questionMasked(CertAdminLocale
040:                                            .getPFString("q20",
041:                                                    CertAdminConstants.q20));
042:                        }
043:                        //String confirmPassphrase = CertAdminUtil.questionMasked("Verify (re-enter) passphrase []");
044:                        String confirmPassphrase = CertAdminUtil
045:                                .questionMasked(CertAdminLocale.getPFString(
046:                                        "q21", CertAdminConstants.q21));
047:                        CertAdminUtil.println(CertAdminConstants.newline);
048:                        if (passphrase.equals(confirmPassphrase)) {
049:                            //println("Passphrase accepted.");
050:                            CertAdminUtil.println(CertAdminLocale.getPFString(
051:                                    "m41", CertAdminConstants.m41));
052:                            boolean stored = false;
053:                            if (cntx.isPasswordEcrypted()) {
054:                                try {
055:                                    stored = CertAdminUtil.writeLine(JSSUtil
056:                                            .encryptPassword(passphrase), cntx
057:                                            .getCertdir()
058:                                            + CertAdminConstants.SEPERATOR
059:                                            + CertAdminConstants.JSSPASSFILE);
060:                                } catch (SRADecoderException ex) {
061:                                    CertAdminUtil.println(CertAdminLocale
062:                                            .getPFString("m55",
063:                                                    CertAdminConstants.m55)
064:                                            + CertAdminConstants.newline + ex);
065:                                    return null;
066:                                }
067:                            } else {
068:                                stored = CertAdminUtil
069:                                        .writeLine(
070:                                                passphrase,
071:                                                cntx.getCertdir()
072:                                                        + CertAdminConstants.SEPERATOR
073:                                                        + CertAdminConstants.JSSPASSFILE);
074:                            }
075:                            //if(!CertAdminUtil.writeLine(passphrase, cntx.getCertdir()+CertAdminConstants.SEPERATOR+CertAdminConstants.JSSPASSFILE)){
076:                            if (!stored) {
077:                                //println("Could not store the password");
078:                                CertAdminUtil.println(CertAdminLocale
079:                                        .getPFString("m42",
080:                                                CertAdminConstants.m42));
081:                            }
082:                            flag = false;
083:                        } else {
084:                            //println("Passwords do not match.");
085:                            CertAdminUtil.println(CertAdminLocale.getPFString(
086:                                    "m43", CertAdminConstants.m43));
087:                        }
088:                    }
089:                } else {
090:                    passphrase = CertAdminUtil.readLine(cntx.getCertdir()
091:                            + CertAdminConstants.SEPERATOR
092:                            + CertAdminConstants.JSSPASSFILE);
093:                    if (cntx.isPasswordEcrypted()) {
094:                        try {
095:                            com.sun.portal.cli.cert.Password pass = JSSUtil
096:                                    .decryptPassword(passphrase);
097:                            passphrase = pass.getPassword();
098:                        } catch (SRADecoderException ex) {
099:                            CertAdminUtil.println(CertAdminLocale.getPFString(
100:                                    "m55", CertAdminConstants.m55)
101:                                    + CertAdminConstants.newline + ex);
102:                            return null;
103:                        }
104:                    }
105:                }
106:                return passphrase;
107:
108:            }
109:
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.