KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > upgrade > certconversion > NSStoNSSConversionModule


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.upgrade.certconversion;
25
26 import java.io.*;
27 import java.util.*;
28 import java.util.logging.*;
29 import java.security.*;
30 import java.security.cert.*;
31 import com.sun.enterprise.tools.upgrade.logging.*;
32 import com.sun.enterprise.util.i18n.StringManager;
33 import com.sun.enterprise.tools.upgrade.common.*;
34
35 /**
36  *
37  * author : Gautam Borah
38  *
39  */

40
41 public class NSStoNSSConversionModule implements BaseModule{
42     
43     private static Logger _logger = LogService.getLogger(LogService.UPGRADE_LOGGER);
44     private StringManager sm;
45     private static final String JavaDoc PKCS12_OUTPUTFILE_OPTION = "-o";
46     private static final String JavaDoc PKCS12_INPUTFILE_OPTION = "-i";
47     private static final String JavaDoc NSS_DB_LOCATION_OPTION = "-d";
48     private static final String JavaDoc ALIAS_OPTION = "-n";
49     private static final String JavaDoc NSS_PWD_OPTION = "-K";
50     private static final String JavaDoc NSS_DB_PREFIX = "-P";
51     private static final String JavaDoc KEYSTORE_PWD_OPTION = "-W";
52     private static final String JavaDoc LIST_KEY_ID = "-K";
53     private static final String JavaDoc CREATE_NSS_DB = "-N";
54     private static final String JavaDoc CERT_NSS_PWD_OPTION = "-f";
55     private static final String JavaDoc CERT_UTIL_UNIX = "certutil.sh";
56     private static final String JavaDoc PK12_UTIL_UNIX = "pk12util.sh";
57     private static final String JavaDoc CERT_UTIL_WIN = "certutil.bat";
58     private static final String JavaDoc PK12_UTIL_WIN = "pk12util.bat";
59     private static final String JavaDoc CONFIG = "config";
60     private static final String JavaDoc BIN = "bin";
61     private static final String JavaDoc LIB = "lib";
62     private static final String JavaDoc UPGRADE = "upgrade";
63     String JavaDoc pathOfNSSDbFiles;
64     private List pkcs12PathList;
65     private List keyList;
66     private CommonInfoModel commonInfo;
67     
68     public NSStoNSSConversionModule(){
69         sm = StringManager.getManager(LogService.UPGRADE_CERTCONVERSION_LOGGER);
70     }
71     
72     public boolean upgrade(CommonInfoModel commonInfo){
73         try {
74             String JavaDoc currentDomain = commonInfo.getCurrentDomain();
75             String JavaDoc currentInstance = currentDomain + ":" + commonInfo.getCurrentSourceInstance();
76             if(!(commonInfo.getDomainOptionList().contains(currentDomain)) || commonInfo.getCertDbPassword() == null)
77                 return true;
78             
79             this.pkcs12PathList=new ArrayList();
80             this.keyList = new ArrayList();
81             this.commonInfo = commonInfo;
82             _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.start_certificate_migration",currentInstance));
83             doBackup(commonInfo);
84             listAllKeysFromSourceInstall();
85             generatePKCS12Certificates();
86             //runPkcs12ToJks();
87
migratePkcs12ToNss("");
88             deletePKCS12Files();
89             _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.finished_certificate_migration",currentInstance));
90         }catch(CertificateException ce) {
91             _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.could_not_migrate_certificates",ce));
92             UpdateProgressManager.getProgressManager().setContinueUpgrade(false);
93             return false;
94         }
95         return true;
96     }
97     
98     private void doBackup(CommonInfoModel commonInfo) throws CertificateException{
99         // Need to take the backup for target 8.xse certificates
100
//doCACertificateBackup();
101
//doKeyPairBackup();
102
}
103     
104     private void doCACertificateBackup() {
105     /*FileInputStream in = null;
106     FileOutputStream out = null;
107     try {
108         KeyStore keystoreSource = KeyStore.getInstance(KeyStore.getDefaultType());
109         KeyStore keystoreTarget = KeyStore.getInstance(KeyStore.getDefaultType());
110         in = new FileInputStream(new File(trustJksPath));
111         keystoreSource.load(in,jksCAkeyStorePassword.toCharArray());
112         keystoreTarget.load(null, jksCAkeyStorePassword.toCharArray());
113         java.util.Enumeration en = keystoreSource.aliases();
114         for(; en.hasMoreElements(); ){
115             String alias = (String) en.nextElement();
116             java.security.cert.Certificate cert = keystoreSource.getCertificate(alias);
117             keystoreTarget.setCertificateEntry(alias,cert);
118         }
119         out = new FileOutputStream(trustJksPath+".back");
120         keystoreTarget.store(out, jksCAkeyStorePassword.toCharArray());
121     } catch (java.security.cert.CertificateException e) {
122         _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
123     } catch (NoSuchAlgorithmException e) {
124          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
125     } catch (FileNotFoundException e) {
126          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
127               // Keystore does not exist
128     } catch (KeyStoreException e) {
129          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
130     } catch (IOException e) {
131          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
132     }catch(Exception e) {
133          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
134     }finally {
135         try {
136             if(in!=null)
137                 in.close();
138             if(out!=null)
139                 out.close();
140         }catch(Exception ex){}
141     } */

142     }
143     
144     private void doKeyPairBackup() {
145     /*FileInputStream in = null;
146     FileOutputStream out = null;
147     try {
148         KeyStore keystoreSource = KeyStore.getInstance(KeyStore.getDefaultType());
149         KeyStore keystoreTarget = KeyStore.getInstance(KeyStore.getDefaultType());
150         in = new FileInputStream(new File(jksPath));
151         keystoreSource.load(in,jksKeyStorePassword.toCharArray());
152         keystoreTarget.load(null, jksKeyStorePassword.toCharArray());
153         java.util.Enumeration en = keystoreSource.aliases();
154         for(; en.hasMoreElements(); ){
155             String alias = (String) en.nextElement();
156             Key key = keystoreSource.getKey(alias, jksKeyStorePassword.toCharArray());
157             java.security.cert.Certificate[] cert = keystoreSource.getCertificateChain(alias);
158             keystoreTarget.setKeyEntry(alias, key, jksKeyStorePassword.toCharArray(), cert);
159         }
160         out = new FileOutputStream(jksPath+".back");
161         keystoreTarget.store(out, jksKeyStorePassword.toCharArray());
162     } catch (java.security.cert.CertificateException e) {
163          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
164     } catch (NoSuchAlgorithmException e) {
165          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
166     } catch (FileNotFoundException e) {
167          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
168               // Keystore does not exist
169     } catch (KeyStoreException e) {
170          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
171     } catch (IOException e) {
172          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
173     }catch(Exception e) {
174          _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.unknownError"),e);
175     }finally {
176         try {
177             if(in!=null)
178                 in.close();
179             if(out!=null)
180                 out.close();
181         }catch(Exception ex){}
182     } */

183     }
184     
185     
186     public void recovery(CommonInfoModel commonInfo) {
187     /*File keypairKeyStoreOriginalFile = new File(jksPath);
188     File keypairKeyStoreBackupFile = new File(jksPath+".back");
189     File trustedKeyStoreOriginalFile = new File(trustJksPath);
190     File trustedKeyStoreBackupFile = new File(trustJksPath+".back");
191     new File(jksPath+".back1").delete();
192     new File(trustJksPath+".back1").delete();
193     boolean success = keypairKeyStoreOriginalFile.renameTo(new File(jksPath+".back1"));
194     if(!success) {
195         _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.could_not_recover_certificates"));
196         return;
197     }
198     success = trustedKeyStoreOriginalFile.renameTo(new File(trustJksPath+".back1"));
199     if(!success) {
200         _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.could_not_recover_certificates"));
201         return;
202     }
203     keypairKeyStoreOriginalFile.delete();
204     trustedKeyStoreOriginalFile.delete();
205     success = keypairKeyStoreBackupFile.renameTo(keypairKeyStoreOriginalFile);
206     if(!success) {
207         _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.could_not_recover_certificates"));
208         File keypairKeyStoreanotherBackupFile = new File(jksPath+".back1");
209         File trustedKeyStoreanotherBackupFile = new File(trustJksPath+".back1");
210         keypairKeyStoreanotherBackupFile.renameTo(keypairKeyStoreOriginalFile);
211         trustedKeyStoreanotherBackupFile.renameTo(trustedKeyStoreOriginalFile);
212         return;
213     }
214     success = trustedKeyStoreBackupFile.renameTo(trustedKeyStoreOriginalFile);
215     if(!success) {
216         _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.could_not_recover_certificates"));
217         File keypairKeyStoreanotherBackupFile = new File(jksPath+".back1");
218         File trustedKeyStoreanotherBackupFile = new File(trustJksPath+".back1");
219         keypairKeyStoreanotherBackupFile.renameTo(keypairKeyStoreOriginalFile);
220         trustedKeyStoreanotherBackupFile.renameTo(trustedKeyStoreOriginalFile);
221         return;
222     }
223     new File(jksPath+".back1").delete();
224     new File(trustJksPath+".back1").delete(); */

225     }
226     
227     private void listAllKeysFromSourceInstall() throws CertificateException{
228         String JavaDoc osName = commonInfo.getOSName();
229         String JavaDoc sourceDomainDir = commonInfo.getSourceInstancePath();
230         String JavaDoc configDir = sourceDomainDir + File.separator + CONFIG;
231         String JavaDoc source70Lib = commonInfo.getSourceInstallDir() +File.separator + LIB;
232         String JavaDoc source70Bin = commonInfo.getSourceInstallDir() +File.separator + BIN;
233         String JavaDoc certUtilPath = "";
234         String JavaDoc certutilLocation = commonInfo.getTargetInstallDir() +File.separator + LIB +File.separator + UPGRADE;
235         if(osName.indexOf("Windows") == -1)
236             certUtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + CERT_UTIL_UNIX;
237         else
238             certUtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + CERT_UTIL_WIN;
239         
240         StringWriter result = new StringWriter();
241         String JavaDoc nssPwd = commonInfo.getCertDbPassword();
242         //String nssPwdFile = commonInfo.getNSSPwdFile();
243
String JavaDoc domainPath = commonInfo.getDestinationDomainPath();
244         String JavaDoc nssPwdFile = domainPath +File.separator +"pwdfile";
245         PrintWriter pw = null;
246         try{
247             pw = new PrintWriter(new FileOutputStream(nssPwdFile ));
248             pw.println(nssPwd);
249             pw.flush();
250             pw.close();
251         }catch(FileNotFoundException fe) {
252             _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.unknownError "),fe);
253         }finally {
254             try {
255                 if(pw !=null)
256                     pw.close();
257             }catch(Exception JavaDoc e){}
258         }
259         String JavaDoc commandString = certUtilPath + " " +
260                 LIST_KEY_ID + " " + NSS_DB_LOCATION_OPTION +
261                 " " + configDir + " " + CERT_NSS_PWD_OPTION +
262                 " " + nssPwdFile +
263                 " " +source70Lib +
264                 " " +source70Bin +
265                 " " +certutilLocation;
266         int exitVal = ProcessAdaptor.executeProcess(commandString, result);
267         result.flush();
268         String JavaDoc resultString = result.toString();
269         if(exitVal == 0) {
270             parseAndGetKeys(resultString);
271         }else {
272             _logger.log(Level.WARNING, sm.getString("enterprise.tools.upgrade.certconversion.error_reading_source_keys",resultString));
273             throw new CertificateException(sm.getString("enterprise.tools.upgrade.certconversion.error_reading_source_keys",resultString));
274         }
275         
276     }
277     
278     private void parseAndGetKeys(String JavaDoc input) {
279         try {
280             BufferedReader reader = new BufferedReader(new StringReader(input));
281             //Reading the Line <0> KEY
282
String JavaDoc readString =reader.readLine();
283             while(readString != null) {
284                 //Key starts from 4th Index
285
String JavaDoc marker = readString.substring(0,1);
286                 String JavaDoc anotherMarker = readString.substring(2,3);
287                 if(!(marker.equals("<") && anotherMarker.equals(">"))) {
288                     _logger.log(Level.WARNING, sm.getString("enterprise.tools.upgrade.certconversion.error_executing_certutil",input));
289                     return;
290                 }
291                 String JavaDoc alias = readString.substring(4);
292                 keyList.add(alias);
293                 _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.alias_info",commonInfo.getCurrentDomain(), alias)); readString =reader.readLine();
294             }
295         }catch (Exception JavaDoc e) {
296             _logger.log(Level.WARNING, sm.getString("enterprise.tools.upgrade.certconversion.unknownError"),e);
297         }
298     }
299     
300     private void generatePKCS12Certificates() throws CertificateException{
301         String JavaDoc osName = commonInfo.getOSName();
302         int size = keyList.size();
303         for (int i =0;i<size;i++) {
304             String JavaDoc pkcsFile = removeWhiteSpace("" + keyList.get(i));
305             String JavaDoc pkcsFilePath = commonInfo.getDestinationDomainPath() + File.separator +pkcsFile +".pkcs12";
306             String JavaDoc sourceDomainDir = commonInfo.getSourceInstancePath();
307             String JavaDoc configDir = sourceDomainDir + File.separator + CONFIG;
308             String JavaDoc source70Lib = commonInfo.getSourceInstallDir() +File.separator + LIB;
309             String JavaDoc source70Bin = commonInfo.getSourceInstallDir() +File.separator + BIN;
310             String JavaDoc pk12UtilPath = "";
311             if(osName.indexOf("Windows") == -1)
312                 pk12UtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + PK12_UTIL_UNIX;
313             else
314                 pk12UtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + PK12_UTIL_WIN;
315             String JavaDoc pk12utilLocation = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + UPGRADE;
316             /*String commandString = pk12UtilPath + " " +
317             PKCS12_OUTPUTFILE_OPTION + " " + pkcsFilePath + " " +
318             NSS_DB_LOCATION_OPTION + " " + configDir + " " +
319             ALIAS_OPTION + " " + keyList.get(i) + " " +
320             NSS_PWD_OPTION + " " + commonInfo.getCertDbPassword() +" " +
321             KEYSTORE_PWD_OPTION + " " + commonInfo.getCertDbPassword(); */

322             String JavaDoc[] commandArray = {pk12UtilPath,
323                     source70Lib,
324                     source70Bin,
325                     pk12utilLocation,
326                     PKCS12_OUTPUTFILE_OPTION, pkcsFilePath,
327                     NSS_DB_LOCATION_OPTION, configDir,
328                     ALIAS_OPTION, ""+ keyList.get(i) + "",
329                     NSS_PWD_OPTION, commonInfo.getCertDbPassword(),
330                     KEYSTORE_PWD_OPTION, commonInfo.getCertDbPassword()
331             };
332             
333             StringWriter result = new StringWriter();
334             //int exitVal = ProcessAdaptor.executeProcess(commandString, result);
335
int exitVal = ProcessAdaptor.executeProcess(commandArray, result);
336             result.flush();
337             //If process execution is successful add pkcs12file to pkcs12PathList
338
if(exitVal == 0)
339                 pkcs12PathList.add(pkcsFilePath);
340             else {
341                 _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.certificateError", keyList.get(i),commonInfo.getCurrentDomain(),result.toString()));
342                 throw new CertificateException(sm.getString("enterprise.tools.upgrade.certconversion.certificateError", keyList.get(i),commonInfo.getCurrentDomain(),result.toString()));
343             }
344         }
345     }
346     
347     private void migratePkcs12ToNss(String JavaDoc certPrefix) throws CertificateException{
348         String JavaDoc osName = commonInfo.getOSName();
349         int size = keyList.size();
350         //for (int i =0;i<size;i++) {
351
//String pkcsFile = removeWhiteSpace("" + keyList.get(i));
352
String JavaDoc configDir = commonInfo.getTargetConfig();//sourceDomainDir + File.separator + CONFIG;
353
String JavaDoc source70Lib = commonInfo.getTargetInstallDir() +File.separator + LIB;
354         String JavaDoc source70Bin = commonInfo.getTargetInstallDir() +File.separator + BIN;
355         String JavaDoc pk12UtilPath = "";
356         if(osName.indexOf("Windows") == -1)
357             pk12UtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + PK12_UTIL_UNIX;
358         else
359             pk12UtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + PK12_UTIL_WIN;
360         //initializeNSSDB(certPrefix);
361
String JavaDoc pk12utilLocation = commonInfo.getTargetInstallDir() + File.separator + LIB;
362         Iterator itr = pkcs12PathList.iterator();
363         while(itr.hasNext()) {
364             String JavaDoc alias = (String JavaDoc)itr.next();
365             _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.processing_keypair",alias));
366             String JavaDoc[] commandArray = {pk12UtilPath,
367                     source70Lib,
368                     source70Bin,
369                     pk12utilLocation,
370                     PKCS12_INPUTFILE_OPTION, alias,
371                     NSS_DB_LOCATION_OPTION, configDir,
372                     NSS_PWD_OPTION, commonInfo.getTargetCertDbPassword(),
373                     KEYSTORE_PWD_OPTION, commonInfo.getCertDbPassword()
374             };
375             
376             StringWriter result = new StringWriter();
377             int exitVal = ProcessAdaptor.executeProcess(commandArray, result);
378             result.flush();
379             if(exitVal == 0) {
380                 _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.alias_transferred",alias));
381             } else {
382                 _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.certificateError", alias,commonInfo.getCurrentDomain(),result.toString()));
383                 throw new CertificateException(sm.getString("enterprise.tools.upgrade.certconversion.certificateError", alias,commonInfo.getCurrentDomain(),result.toString()));
384             }
385         }
386         
387         //} //end of for
388
}
389     
390     private void initializeNSSDB(String JavaDoc certPrefix) throws CertificateException {
391         String JavaDoc osName = commonInfo.getOSName();
392         String JavaDoc sourceDomainDir = commonInfo.getSourceInstancePath();
393         String JavaDoc configDir = commonInfo.getTargetConfig();
394         String JavaDoc source70Lib = commonInfo.getSourceInstallDir() +File.separator + LIB;
395         String JavaDoc source70Bin = commonInfo.getSourceInstallDir() +File.separator + BIN;
396         String JavaDoc certutilLocation = commonInfo.getTargetInstallDir() +File.separator + LIB;
397         String JavaDoc certUtilPath = "";
398         if(osName.indexOf("Windows") == -1)
399             certUtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + CERT_UTIL_UNIX;
400         else
401             certUtilPath = commonInfo.getTargetInstallDir() + File.separator + LIB + File.separator + CERT_UTIL_WIN;
402         File key3db = new File(configDir+File.separator+certPrefix+"key3.db");
403         //If DB is already there, don't do anything
404
if(key3db.exists())
405             return;
406         StringWriter result = new StringWriter();
407         String JavaDoc nssPwd = commonInfo.getTargetCertDbPassword();
408         //String nssPwdFile = commonInfo.getNSSPwdFile();
409
String JavaDoc domainPath = commonInfo.getDestinationDomainPath();
410         String JavaDoc nssPwdFile = domainPath +File.separator +"pwdfile";
411         PrintWriter pw = null;
412         try{
413             pw = new PrintWriter(new FileOutputStream(nssPwdFile ));
414             pw.println(nssPwd);
415             pw.flush();
416             pw.close();
417         }catch(FileNotFoundException fe) {
418             _logger.log(Level.INFO,sm.getString("enterprise.tools.upgrade.certconversion.unknownError "),fe);
419         }finally {
420             try {
421                 if(pw !=null)
422                     pw.close();
423             }catch(Exception JavaDoc e){}
424         }
425         String JavaDoc commandString = certUtilPath + " " +
426                 CREATE_NSS_DB + " " +NSS_DB_LOCATION_OPTION +
427                 " " + configDir + " " +NSS_DB_PREFIX +
428                 " "+ certPrefix + " " +CERT_NSS_PWD_OPTION +
429                 " " + nssPwdFile +
430                 " " +source70Lib +
431                 " " +source70Bin +
432                 " " +certutilLocation;
433         int exitVal = ProcessAdaptor.executeProcess(commandString, result);
434         result.flush();
435         String JavaDoc resultString = result.toString();
436         if(exitVal == 0) {
437             //parseAndGetKeys(resultString);
438
}else {
439             _logger.log(Level.WARNING, sm.getString("enterprise.tools.upgrade.certconversion.error_executing_certutil",resultString));
440             throw new CertificateException(sm.getString("enterprise.tools.upgrade.certconversion.error_executing_certutil",resultString));
441         }
442     }
443     
444     private String JavaDoc removeWhiteSpace(String JavaDoc str) {
445         
446         String JavaDoc concat="";
447         StringTokenizer st = new StringTokenizer(str);
448         while(st.hasMoreTokens()) {
449             concat=concat+st.nextToken();
450         }
451         return concat;
452     }
453     
454     
455     private void deletePKCS12Files() {
456         String JavaDoc pkcsFilesPath = commonInfo.getDestinationDomainPath();
457         String JavaDoc[] fileList = new File(pkcsFilesPath).list();
458         for(int i=0; i<fileList.length; i++){
459             File pkcsFile = new File(pkcsFilesPath+File.separator+fileList[i]);
460             if(pkcsFile.isFile() && fileList[i].endsWith(".pkcs12") ){
461                 pkcsFile.delete();
462             }
463         }
464         String JavaDoc domainPath = commonInfo.getDestinationDomainPath();
465         String JavaDoc nssPwdFile = domainPath +File.separator +"pwdfile";
466         File pwdfile = new File(nssPwdFile);
467         pwdfile.delete();
468     }
469     
470     public static void main(String JavaDoc[] args){
471         CommonInfoModel commonInfo = new CommonInfoModel();
472         commonInfo.setSourceInstallDir(args[0]);
473         commonInfo.setTargetInstallDir(args[1]);
474         commonInfo.setCertDbPassword(args[2]);
475         commonInfo.setJksKeystorePassword(args[3]);
476         NSStoJKSConversionModule convModule = new NSStoJKSConversionModule();
477         convModule.upgrade(commonInfo);
478     }
479     
480     public String JavaDoc getName() {
481         return sm.getString("enterprise.tools.upgrade.certconversion.moduleName");
482     }
483     
484 }
485
486
Popular Tags