summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/apps/CMS.java
blob: 376dce8b0e1d678151fc3fd5e78267feb1fbdbd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.apps;


import com.netscape.cmsutil.http.*;
import com.netscape.cmsutil.net.*;
import java.io.*;
import java.util.*;
import java.math.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.security.cert.X509CRL;
import netscape.ldap.*;
import netscape.security.x509.*;
import netscape.security.util.*;
import com.netscape.certsrv.common.*;
import com.netscape.certsrv.password.*;
import com.netscape.certsrv.base.*;
import com.netscape.certsrv.dbs.*;
import com.netscape.certsrv.dbs.crldb.*;
import com.netscape.certsrv.dbs.repository.*;
import com.netscape.certsrv.request.*;
import com.netscape.certsrv.authority.*;
import com.netscape.certsrv.ca.*;
import com.netscape.certsrv.kra.*;
import com.netscape.certsrv.policy.*;
import com.netscape.certsrv.registry.*;
import com.netscape.certsrv.security.*;
import com.netscape.certsrv.ldap.*;
import com.netscape.certsrv.notification.*;
import com.netscape.certsrv.profile.*;
import com.netscape.certsrv.ra.*;
import com.netscape.certsrv.connector.*;
import com.netscape.certsrv.ocsp.*;
import com.netscape.certsrv.logging.*;
import com.netscape.certsrv.selftests.*;
import com.netscape.certsrv.usrgrp.*;
import com.netscape.certsrv.jobs.*;
import com.netscape.certsrv.authentication.*;
import com.netscape.certsrv.authorization.*;
import com.netscape.certsrv.acls.*;
import com.netscape.certsrv.tks.*;
import org.mozilla.jss.util.PasswordCallback;
import org.mozilla.jss.CryptoManager.CertificateUsage;
import java.security.NoSuchAlgorithmException;
import com.netscape.cmsutil.password.*;


/**
 * This represents the CMS server. Plugins can access other
 * public objects such as subsystems via this inteface. 
 * This object also include a set of utility functions.
 *
 * This object does not include the actual implementation.
 * It acts as a public interface for plugins, and the
 * actual implementation is in the CMS engine 
 * (com.netscape.cmscore.apps.CMSEngine) that implements 
 * ICMSEngine interface.
 *
 * @version $Revision$, $Date$
 */
public final class CMS {

    public static final int DEBUG_OBNOXIOUS = 10;
    public static final int DEBUG_VERBOSE = 5;
    public static final int DEBUG_INFORM = 1;

    private static final String CONFIG_FILE = "CS.cfg";
    private static ICMSEngine _engine = null;

    public static final String SUBSYSTEM_LOG = ILogSubsystem.ID;
    public static final String SUBSYSTEM_CRYPTO = ICryptoSubsystem.ID;
    public static final String SUBSYSTEM_DBS = IDBSubsystem.SUB_ID;
    public static final String SUBSYSTEM_CA = ICertificateAuthority.ID;
    public static final String SUBSYSTEM_RA = IRegistrationAuthority.ID;
    public static final String SUBSYSTEM_KRA = IKeyRecoveryAuthority.ID;
    public static final String SUBSYSTEM_OCSP = IOCSPAuthority.ID;
    public static final String SUBSYSTEM_TKS = ITKSAuthority.ID;
   public static final String SUBSYSTEM_UG = IUGSubsystem.ID;
    public static final String SUBSYSTEM_AUTH = IAuthSubsystem.ID;
    public static final String SUBSYSTEM_AUTHZ = IAuthzSubsystem.ID;
    public static final String SUBSYSTEM_REGISTRY = IPluginRegistry.ID;
    public static final String SUBSYSTEM_PROFILE = IProfileSubsystem.ID;
    public static final String SUBSYSTEM_JOBS = IJobsScheduler.ID;
    public static final String SUBSYSTEM_SELFTESTS = ISelfTestSubsystem.ID;
    public static final int PRE_OP_MODE = 0;
    public static final int RUNNING_MODE = 1;

    /**
     * Private constructor.
     *
     * @param engine CMS engine implementation
     */
    private CMS(ICMSEngine engine) {
        _engine = engine;
    }

    /**
     * This method is used for unit tests.  It allows the underlying _engine
     * to be stubbed out.
     * @param engine The stub engine to set, for testing.
     */
    public static void setCMSEngine(ICMSEngine engine) {
        _engine = engine;
    }

    /**
     * Gets this ID .
     *
     * @return CMS engine identifier
     */
    public static String getId() {
        return _engine.getId();
    }

    /**
     * Sets the identifier of this subsystem. Should never be called. 
     * Returns error. 
     *
     * @param id CMS engine identifier
     */
    public static void setId(String id) throws EBaseException {
        _engine.setId(id);
    }

    /**
     * Initialize all static, dynamic and final static subsystems.
     *
     * @param owner null
     * @param config main config store.
     * @exception EBaseException if any error occur in subsystems during 
     * initialization.
     */
    public static void init(ISubsystem owner, IConfigStore config) 
        throws EBaseException {
        _engine.init(owner, config);
    }

    public static void reinit(String id) throws EBaseException {
        _engine.reinit(id);
    }

    /**
     * Starts up all subsystems. subsystems must be initialized.
     *
     * @exception EBaseException if any subsystem fails to startup.
     */
    public static void startup() throws EBaseException {
        _engine.startup();
    }

    /**
     * Blocks all new incoming requests.
     */
    public static void disableRequests() {
        _engine.disableRequests();
    }

    /**
     * Terminates all requests that are currently in process.
     */
    public static void terminateRequests() {
        _engine.terminateRequests();
    }

    /**
     * Checks to ensure that all new incoming requests have been blocked.
     * This method is used for reentrancy protection.
     * <P>
     *
     * @return true or false
     */
    public static boolean areRequestsDisabled() {
        return _engine.areRequestsDisabled();
    }

    /**
     * Shuts down subsystems in backwards order 
     * exceptions are ignored. process exists at end to force exit.
     */
    public static void shutdown() {
        _engine.shutdown();
    }

    /**
     * Shuts down subsystems in backwards order
     * exceptions are ignored. process exists at end to force exit.
     */

     public static void forceShutdown() {

         _engine.forceShutdown();
     }

     /**
      * mode = 0 (pre-operational)
      * mode = 1 (running)
      */
     public static void setCSState(int mode) {
         _engine.setCSState(mode);
     }

     public static int getCSState() {
         return _engine.getCSState();
     }

    public static boolean isPreOpMode() {
        return _engine.isPreOpMode();
    }

    public static boolean isRunningMode() {
        return _engine.isRunningMode();
    }

    /**
     * Is the server in running state. After server startup, the
     * server will be initialization state first. After the
     * initialization state, the server will be in the running 
     * state.
     * 
     * @return true if the server is in the running state
     */
    public static boolean isInRunningState() {
        return _engine.isInRunningState();
    }

    /**
     * Returns the logger of the current server. The logger can
     * be used to log critical informational or critical error
     * messages.
     *
     * @return logger
     */
    public static ILogger getLogger() {
        return _engine.getLogger();
    }

    /**
     * Returns the signed audit logger of the current server. This logger can
     * be used to log critical informational or critical error
     * messages.
     *
     * @return signed audit logger
     */
    public static ILogger getSignedAuditLogger() {
        return _engine.getSignedAuditLogger();
    }

    /**
     * Creates a repository record in the internal database.
     *
     * @return repository record
     */
    public static IRepositoryRecord createRepositoryRecord() {
        return _engine.createRepositoryRecord();
    }

    /**
     * Parse ACL resource attributes
     * @param resACLs same format as the resourceACLs attribute:
     * <PRE>
     *     <resource name>:<permission1,permission2,...permissionn>:
     *     <allow|deny> (<subset of the permission set>) <evaluator expression>
     * </PRE>
     * @exception EACLsException ACL related parsing errors for resACLs
     * @return an ACL instance built from the parsed resACLs
     */
    public static IACL parseACL(String resACLs) throws EACLsException {
        return _engine.parseACL(resACLs);
    }

    /**
     * Creates an issuing poing record.
     *
     * @return issuing record
     */
    public static ICRLIssuingPointRecord createCRLIssuingPointRecord(String id, BigInteger crlNumber, Long crlSize, Date thisUpdate, Date nextUpdate) {
        return _engine.createCRLIssuingPointRecord(id, crlNumber, crlSize, thisUpdate, nextUpdate);
    }

    /**
     * Retrieves the default CRL issuing point record name.
     *
     * @return CRL issuing point record name
     */
    public static String getCRLIssuingPointRecordName() {
        return _engine.getCRLIssuingPointRecordName();
    }

    /**
     * Retrieves the process id of this server.
     *
     * @return process id of the server
     */
    public static int getpid() {
        return _engine.getpid();
    }

    /**
     * Retrieves the instance roort path of this server.
     *
     * @return instance directory path name
     */
    public static String getInstanceDir() {
        return _engine.getInstanceDir();
    }

    /**
     * Returns a server wide system time. Plugins should call
     * this method to retrieve system time.
     *
     * @return current time
     */
    public static Date getCurrentDate() {
        if (_engine == null)
            return new Date();
        return _engine.getCurrentDate();
    }

    /**
     * Puts data of an byte array into the debug file.
     *
     * @param data byte array to be recorded in the debug file
     */
    public static void debug(byte data[]) {
        if (_engine != null)
            _engine.debug(data);
    }

    /**
     * Puts a message into the debug file.
     *
     * @param msg debugging message
     */
    public static void debug(String msg) {
        if (_engine != null)
            _engine.debug(msg);
    }

    /**
     * Puts a message into the debug file.
     *
     * @param level 0-10 (0 is less detail, 10 is more detail)
     * @param msg debugging message
     */
    public static void debug(int level, String msg) {
        if (_engine != null)
            _engine.debug(level, msg);
    }

    /**
     * Puts an exception into the debug file.
     *
     * @param e exception
     */
    public static void debug(Throwable e) {
        if (_engine != null)
            _engine.debug(e);
    }

    /**
     * Checks if the debug mode is on or not.
     *
     * @return true if debug mode is on
     */
    public static boolean debugOn() {
        if (_engine != null)
            return _engine.debugOn();
        return false;
    }

    /**
     * Puts the current stack trace in the debug file.
     */
    public static void debugStackTrace() {
        if (_engine != null)
            _engine.debugStackTrace();
    }

	/*
	 * If debugging for the particular realm is enabled, output name/value
	 * pair info to the debug file. This is useful to dump out what hidden
	 * config variables the server is looking at, or what HTTP variables it
	 * is expecting to find, or what database attributes it is looking for.
	 * @param type indicates what the source of key/val is. For example,
     *     this could be 'CS.cfg', or something else. In the debug
	 *     subsystem, there is a mechanism to filter this so only the types 
     *     you care about are listed
	 * @param key  the 'key' of the hashtable which is being accessed.
	 *     This could be the name of the config parameter, or the http param
	 *     name.
	 * @param val  the value of the parameter
     * @param default the default value if the param is not found
	 */

    public static void traceHashKey(String type, String key) {
        if (_engine != null) {
			_engine.traceHashKey(type, key);
		}
	}
    public static void traceHashKey(String type, String key, String val) {
        if (_engine != null) {
			_engine.traceHashKey(type, key, val);
		}
	}
    public static void traceHashKey(String type, String key, String val, String def) {
        if (_engine != null) {
			_engine.traceHashKey(type, key, val, def);
		}
	}


    /**
     * Returns the names of all the registered subsystems.
     *
     * @return a list of string-based subsystem names
     */
    public static Enumeration getSubsystemNames() {
        return _engine.getSubsystemNames();
    }

    public static byte[] getPKCS7(Locale locale, IRequest req) {
        return _engine.getPKCS7(locale, req);
    }

    /**
     * Returns all the registered subsystems.
     *
     * @return a list of ISubsystem-based subsystems
     */
    public static Enumeration getSubsystems() {
        return _engine.getSubsystems();
    }

    /**
     * Retrieves the registered subsytem with the given name.
     *
     * @param name subsystem name
     * @return subsystem of the given name
     */
    public static ISubsystem getSubsystem(String name) {
        return _engine.getSubsystem(name);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param msgID message id defined in UserMessages.properties
     * @return localized user message
     */
    public static String getUserMessage(String msgID) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(null /* from session context */, msgID);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param locale end-user locale
     * @param msgID message id defined in UserMessages.properties
     * @return localized user message
     */
    public static String getUserMessage(Locale locale, String msgID) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(locale, msgID);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @return localized user message
     */
    public static String getUserMessage(String msgID, String p1) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(null /* from session context */, msgID, p1);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param locale end-user locale
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @return localized user message
     */
    public static String getUserMessage(Locale locale, String msgID, String p1) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(locale, msgID, p1);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @return localized user message
     */
    public static String getUserMessage(String msgID, String p1, String p2) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(null /* from session context */, msgID, p1, p2);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param locale end-user locale
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @return localized user message
     */
    public static String getUserMessage(Locale locale, String msgID, String p1, String p2) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(locale, msgID, p1, p2);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @return localized user message
     */
    public static String getUserMessage(String msgID, String p1, String p2, String p3) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(null /* from session context */, msgID, p1, p2, p3);
    }

    public static LDAPConnection getBoundConnection(String host, int port,
               int version, LDAPSSLSocketFactoryExt fac, String bindDN,
               String bindPW) throws LDAPException
    {
         return _engine.getBoundConnection(host, port, version, fac,
                         bindDN, bindPW);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param locale end-user locale
     * @param msgID message id defined in UserMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @return localized user message
     */
    public static String getUserMessage(Locale locale, String msgID, String p1, String p2, String p3) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(locale, msgID, p1, p2, p3);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param msgID message id defined in UserMessages.properties
     * @param p an array of parameters
     * @return localized user message
     */
    public static String getUserMessage(String msgID, String p[]) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(null /* from session context */, msgID, p);
    }

    /**
     * Retrieves the localized user message from UserMessages.properties.
     *
     * @param locale end-user locale
     * @param msgID message id defined in UserMessages.properties
     * @param p an array of parameters
     * @return localized user message
     */
    public static String getUserMessage(Locale locale, String msgID, String p[]) {
        if (_engine == null)
            return msgID;
        return _engine.getUserMessage(locale, msgID, p);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @return localized log message
     */
    public static String getLogMessage(String msgID) {
        return _engine.getLogMessage(msgID);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p an array of parameters
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p[]) {
        return _engine.getLogMessage(msgID, p);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1) {
        return _engine.getLogMessage(msgID, p1);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2) {
        return _engine.getLogMessage(msgID, p1, p2);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3) {
        return _engine.getLogMessage(msgID, p1, p2, p3);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @param p5 5th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4, String p5) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4, p5);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @param p5 5th parameter
     * @param p6 6th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4, String p5, String p6) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4, p5, p6);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @param p5 5th parameter
     * @param p6 6th parameter
     * @param p7 7th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4, String p5, String p6, String p7) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4, p5, p6, p7);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @param p5 5th parameter
     * @param p6 6th parameter
     * @param p7 7th parameter
     * @param p8 8th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4, p5, p6, p7, p8);
    }

    /**
     * Retrieves the centralized log message from LogMessages.properties.
     *
     * @param msgID message id defined in LogMessages.properties
     * @param p1 1st parameter
     * @param p2 2nd parameter
     * @param p3 3rd parameter
     * @param p4 4th parameter
     * @param p5 5th parameter
     * @param p6 6th parameter
     * @param p7 7th parameter
     * @param p8 8th parameter
     * @param p9 9th parameter
     * @return localized log message
     */
    public static String getLogMessage(String msgID, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) {
        return _engine.getLogMessage(msgID, p1, p2, p3, p4, p5, p6, p7, p8, p9);
    }

    /**
     * Returns the main config store. It is a handle to CMS.cfg.
     *
     * @return configuration store
     */
    public static IConfigStore getConfigStore() {
        return _engine.getConfigStore();
    }

    /**
     * Retrieves time server started up.
     *
     * @return last startup time
     */
    public static long getStartupTime() {
        return _engine.getStartupTime();
    }

    /**
     * Retrieves the HTTP Connection for use with connector.
     *
     * @param authority remote authority
     * @param factory socket factory
     * @return http connection to the remote authority
     */
    public static IHttpConnection getHttpConnection(IRemoteAuthority authority, 
        ISocketFactory factory) {
        return _engine.getHttpConnection(authority, factory);
    }

    /**
     * Retrieves the HTTP Connection for use with connector.
     *
     * @param authority remote authority
     * @param factory socket factory
     * @param timeout return error if connection cannot be established within
     *       the timeout period
     * @return http connection to the remote authority
     */
    public static IHttpConnection getHttpConnection(IRemoteAuthority authority, 
        ISocketFactory factory, int timeout) {
        return _engine.getHttpConnection(authority, factory, timeout);
    }

    /**
     * Retrieves the request sender for use with connector.
     *
     * @param authority local authority
     * @param nickname nickname of the client certificate
     * @param remote remote authority
     * @param interval timeout interval
     * @return resender
     */
    public static IResender getResender(IAuthority authority, String nickname, 
        IRemoteAuthority remote, int interval) {
        return _engine.getResender(authority, nickname, remote, interval);
    }

    /**
     * Retrieves the nickname of the server's server certificate.
     * 
     * @return nickname of the server certificate
     */
    public static String getServerCertNickname() {
        return _engine.getServerCertNickname();
    }

    /**
     * Sets the nickname of the server's server certificate.
     *
     * @param tokenName name of token where the certificate is located
     * @param nickName name of server certificate
     */
    public static void setServerCertNickname(String tokenName, String nickName) {
        _engine.setServerCertNickname(tokenName, nickName);
    }

    /**
     * Sets the nickname of the server's server certificate.
     *
     * @param newName new nickname of server certificate
     */
    public static void setServerCertNickname(String newName) {
        _engine.setServerCertNickname(newName);
    }

    /**
     * Retrieves the host name of the server's secure end entity service.
     *
     * @return host name of end-entity service
     */
    public static String getEEHost() {
        return _engine.getEEHost();
    }

    /**
     * Retrieves the host name of the server's non-secure end entity service.
     *
     * @return host name of end-entity non-secure service
     */
    public static String getEENonSSLHost() {
        return _engine.getEENonSSLHost();
    }

    /**
     * Retrieves the IP address of the server's non-secure end entity service.
     *
     * @return ip address of end-entity non-secure service
     */
    public static String getEENonSSLIP() {
        return _engine.getEENonSSLIP();
    }

    /**
     * Retrieves the port number of the server's non-secure end entity service.
     *
     * @return port of end-entity non-secure service
     */
    public static String getEENonSSLPort() {
        return _engine.getEENonSSLPort();
    }

    /**
     * Retrieves the host name of the server's secure end entity service.
     *
     * @return port of end-entity secure service
     */
    public static String getEESSLHost() {
        return _engine.getEESSLHost();
    }

    /**
     * Retrieves the host name of the server's secure end entity service.
     *
     * @return port of end-entity secure service
     */
    public static String getEEClientAuthSSLPort() {
        return _engine.getEEClientAuthSSLPort();
    }

    /**
     * Retrieves the IP address of the server's secure end entity service.
     *
     * @return ip address of end-entity secure service
     */
    public static String getEESSLIP() {
        return _engine.getEESSLIP();
    }

    /**
     * Retrieves the port number of the server's secure end entity service.
     *
     * @return port of end-entity secure service
     */
    public static String getEESSLPort() {
        return _engine.getEESSLPort();
    }

    /**
     * Retrieves the host name of the server's agent service.
     *
     * @return host name of agent service
     */
    public static String getAgentHost() {
        return _engine.getAgentHost();
    }

    /**
     * Retrieves the IP address of the server's agent service.
     *
     * @return ip address of agent service
     */
    public static String getAgentIP() {
        return _engine.getAgentIP();
    }

    /**
     * Retrieves the port number of the server's agent service.
     *
     * @return port of agent service
     */
    public static String getAgentPort() {
        return _engine.getAgentPort();
    }

    /**
     * Retrieves the host name of the server's administration service.
     *
     * @return host name of administration service
     */
    public static String getAdminHost() {
        return _engine.getAdminHost();
    }

    /**
     * Retrieves the IP address of the server's administration service.
     *
     * @return ip address of administration service
     */
    public static String getAdminIP() {
        return _engine.getAdminIP();
    }

    /**
     * Retrieves the port number of the server's administration service.
     *
     * @return port of administration service
     */
    public static String getAdminPort() {
        return _engine.getAdminPort();
    }

    /**
     * Creates a general name constraints.
     *
     * @param generalNameChoice type of general name
     * @param value general name string
     * @return general name object
     * @exception EBaseException failed to create general name constraint
     */
    public static GeneralName form_GeneralNameAsConstraints(String generalNameChoice, String value) throws EBaseException {
        return _engine.form_GeneralName(generalNameChoice, value);
    }

    /**
     * Creates a general name.
     *
     * @param generalNameChoice type of general name
     * @param value general name string
     * @return general name object
     * @exception EBaseException failed to create general name
     */
    public static GeneralName form_GeneralName(String generalNameChoice,
        String value) throws EBaseException {
        return _engine.form_GeneralName(generalNameChoice, value);
    }

    /**
     * Get default parameters for subject alt name configuration.
     * 
     * @param name configuration name
     * @param params configuration parameters
     */
    public static void getSubjAltNameConfigDefaultParams(String name, 
        Vector params) {
        _engine.getSubjAltNameConfigDefaultParams(name, params);
    }

    /**
     * Get extended plugin info for subject alt name configuration.
     *
     * @param name configuration name
     * @param params configuration parameters
     */
    public static void getSubjAltNameConfigExtendedPluginInfo(String name, 
        Vector params) {
        _engine.getSubjAltNameConfigExtendedPluginInfo(name, params);
    }

    /**
     * Creates subject alt name configuration.
     *
     * @param name configuration name
     * @param config configuration store
     * @param isValueConfigured true if value is configured
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static ISubjAltNameConfig createSubjAltNameConfig(String name, IConfigStore config, boolean isValueConfigured) throws EBaseException {
        return _engine.createSubjAltNameConfig(
                name, config, isValueConfigured);
    }

    /**
     * Retrieves default general name configuration.
     *
     * @param name configuration name
     * @param isValueConfigured true if value is configured
     * @param params configuration parameters
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static void getGeneralNameConfigDefaultParams(String name,
        boolean isValueConfigured, Vector params) {
        _engine.getGeneralNameConfigDefaultParams(name,
            isValueConfigured, params);
    }

    /**
     * Retrieves default general names configuration.
     *
     * @param name configuration name
     * @param isValueConfigured true if value is configured
     * @param params configuration parameters
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static void getGeneralNamesConfigDefaultParams(String name,
        boolean isValueConfigured, Vector params) {
        _engine.getGeneralNamesConfigDefaultParams(name,
            isValueConfigured, params);
    }

    /**
     * Retrieves extended plugin info for general name configuration.
     *
     * @param name configuration name
     * @param isValueConfigured true if value is configured
     * @param info configuration parameters
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static void getGeneralNameConfigExtendedPluginInfo(String name,
        boolean isValueConfigured, Vector info) {
        _engine.getGeneralNameConfigExtendedPluginInfo(name,
            isValueConfigured, info);
    }

    /**
     * Retrieves extended plugin info for general name configuration.
     *
     * @param name configuration name
     * @param isValueConfigured true if value is configured
     * @param info configuration parameters
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static void getGeneralNamesConfigExtendedPluginInfo(String name,
        boolean isValueConfigured, Vector info) {
        _engine.getGeneralNamesConfigExtendedPluginInfo(name,
            isValueConfigured, info);
    }

    /**
     * Created general names configuration.
     *
     * @param name configuration name
     * @param config configuration store
     * @param isValueConfigured true if value is configured
     * @param isPolicyEnabled true if policy is enabled
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static IGeneralNamesConfig createGeneralNamesConfig(String name, 
        IConfigStore config, boolean isValueConfigured, 
        boolean isPolicyEnabled) throws EBaseException {
        return _engine.createGeneralNamesConfig(name, config, isValueConfigured,
                isPolicyEnabled);
    }

    /**
     * Created general name constraints configuration.
     *
     * @param name configuration name
     * @param config configuration store
     * @param isValueConfigured true if value is configured
     * @param isPolicyEnabled true if policy is enabled
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static IGeneralNameAsConstraintsConfig createGeneralNameAsConstraintsConfig(String name, IConfigStore config, boolean isValueConfigured, 
        boolean isPolicyEnabled) throws EBaseException {
        return _engine.createGeneralNameAsConstraintsConfig(
                name, config, isValueConfigured, isPolicyEnabled);
    }

    /**
     * Created general name constraints configuration.
     *
     * @param name configuration name
     * @param config configuration store
     * @param isValueConfigured true if value is configured
     * @param isPolicyEnabled true if policy is enabled
     * @exception EBaseException failed to create subject alt name configuration
     */
    public static IGeneralNamesAsConstraintsConfig createGeneralNamesAsConstraintsConfig(String name, IConfigStore config, boolean isValueConfigured, 
        boolean isPolicyEnabled) throws EBaseException {
        return _engine.createGeneralNamesAsConstraintsConfig(
                name, config, isValueConfigured, isPolicyEnabled);
    }

    /**
     * Returns the finger print of the given certificate.
     *
     * @param cert certificate 
     * @return finger print of certificate
     */
    public static String getFingerPrint(Certificate cert)
        throws CertificateEncodingException, NoSuchAlgorithmException {
        return _engine.getFingerPrint(cert);
    }

    /**
     * Returns the finger print of the given certificate.
     *
     * @param certDer DER byte array of the certificate 
     * @return finger print of certificate
     */
    public static String getFingerPrints(byte[] certDer)
        throws NoSuchAlgorithmException {
        return _engine.getFingerPrints(certDer);
    }

    /**
     * Returns the finger print of the given certificate.
     *
     * @param cert certificate 
     * @return finger print of certificate
     */
    public static String getFingerPrints(Certificate cert)
        throws NoSuchAlgorithmException, CertificateEncodingException {
        return _engine.getFingerPrints(cert);
    }

    /** 
     * Creates a HTTP PKI Message that can be sent to a remote
     * authority.
     *
     * @return a new PKI Message for remote authority
     */
    public static IPKIMessage getHttpPKIMessage() {
        return _engine.getHttpPKIMessage();
    }

    /** 
     * Creates a request encoder. A request cannot be sent to
     * the remote authority in its regular format.
     *
     * @return a request encoder
     */
    public static IRequestEncoder getHttpRequestEncoder() {
        return _engine.getHttpRequestEncoder();
    }

    /** 
     * Converts a BER-encoded byte array into a MIME-64 encoded string.
     *
     * @param data data in byte array format
     * @return base-64 encoding for the data
     */
    public static String BtoA(byte data[]) {
        return _engine.BtoA(data);
    }

    /** 
     * Converts a MIME-64 encoded string into a BER-encoded byte array.
     *
     * @param data base-64 encoding for the data
     * @return data data in byte array format
     */
    public static byte[] AtoB(String data) {
        return _engine.AtoB(data);
    }

    /**
     * Retrieves the ldap connection information from the configuration
     * store.
     *
     * @param config configuration parameters of ldap connection
     * @return a LDAP connection info
     */
    public static ILdapConnInfo getLdapConnInfo(IConfigStore config)
        throws EBaseException, ELdapException {
        return _engine.getLdapConnInfo(config);
    }

    /**
     * Creates a LDAP SSL socket with the given nickname. The 
     * certificate associated with the nickname will be used
     * for client authentication.
     *
     * @param certNickname nickname of client certificate
     * @return LDAP SSL socket factory
     */
    public static  LDAPSSLSocketFactoryExt getLdapJssSSLSocketFactory(
        String certNickname) {
        return _engine.getLdapJssSSLSocketFactory(certNickname);
    }

    /**
     * Creates a LDAP SSL socket.
     *
     * @return LDAP SSL socket factory
     */
    public static  LDAPSSLSocketFactoryExt getLdapJssSSLSocketFactory() {
        return _engine.getLdapJssSSLSocketFactory();
    }

    /**
     * Creates a LDAP Auth Info object.
     *
     * @return LDAP authentication info
     */
    public static ILdapAuthInfo getLdapAuthInfo() {
        return _engine.getLdapAuthInfo();
    }

    /**
     * Retrieves the LDAP connection factory.
     *
     * @return bound LDAP connection pool
     */
    public static ILdapConnFactory getLdapBoundConnFactory()
        throws ELdapException {
        return _engine.getLdapBoundConnFactory();
    }

    /**
     * Retrieves the LDAP connection factory.
     *
     * @return anonymous LDAP connection pool
     */
    public static ILdapConnFactory getLdapAnonConnFactory()
        throws ELdapException {
        return _engine.getLdapAnonConnFactory();
    }

    /**
     * Retrieves the default X.509 certificate template.
     *
     * @return default certificate template
     */
    public static X509CertInfo getDefaultX509CertInfo() {
        return _engine.getDefaultX509CertInfo();
    }

    /**
     * Retrieves the certifcate in MIME-64 encoded format
     * with header and footer.
     *
     * @param cert certificate
     * @return base-64 format certificate
     */
    public static String getEncodedCert(X509Certificate cert) {
        return _engine.getEncodedCert(cert);
    }

   /**
    * Verifies all system certs
    *  with tags defined in <subsystemtype>.cert.list
    */
    public static boolean verifySystemCerts() {
        return _engine.verifySystemCerts();
    }

   /**
    * Verify a system cert by tag name
    *  with tags defined in <subsystemtype>.cert.list
    */
    public static boolean verifySystemCertByTag(String tag) {
        return _engine.verifySystemCertByTag(tag);
    }

   /**
    * Verify a system cert by certificate nickname
    */
    public static boolean verifySystemCertByNickname(String nickname, String certificateUsage) {
        return _engine.verifySystemCertByNickname(nickname, certificateUsage);
    }

    /**
     * get the CertificateUsage as defined in JSS CryptoManager
     */
    public static CertificateUsage getCertificateUsage(String certusage) {
        return _engine.getCertificateUsage(certusage);
    }

    /**
     * Checks if the given certificate is a signing certificate.
     *
     * @param cert certificate
     * @return true if the given certificate is a signing certificate
     */
    public static boolean isSigningCert(X509Certificate cert) {
        return _engine.isSigningCert(cert);
    }

    /**
     * Checks if the given certificate is an encryption certificate.
     *
     * @param cert certificate
     * @return true if the given certificate is an encryption certificate
     */
    public static boolean isEncryptionCert(X509Certificate cert) {
        return _engine.isEncryptionCert(cert);
    }

    /**
     * Retrieves the email form processor.
     *
     * @return email form processor
     */
    public static IEmailFormProcessor getEmailFormProcessor() {
        return _engine.getEmailFormProcessor();
    }

    /**
     * Retrieves the email form template.
     *
     * @return email template
     */
    public static IEmailTemplate getEmailTemplate(String path) {
        return _engine.getEmailTemplate(path);
    }

    /**
     * Retrieves the email notification handler.
     *
     * @return email notification
     */
    public static IMailNotification getMailNotification() {
        return _engine.getMailNotification();
    }

    /**
     * Retrieves the email key resolver.
     *
     * @return email key resolver
     */
    public static IEmailResolverKeys getEmailResolverKeys() {
        return _engine.getEmailResolverKeys();
    }

    /**
     * Checks if the given OID is valid.
     *
     * @param attrName attribute name
     * @param value attribute value
     * @return object identifier of the given attrName
     */
    public static ObjectIdentifier checkOID(String attrName, String value) 
        throws EBaseException { 
        return _engine.checkOID(attrName, value);
    }

    /**
     * Retrieves the email resolver that checks for subjectAlternateName.
     *
     * @return email key resolver
     */
    public static IEmailResolver getReqCertSANameEmailResolver() {
        return _engine.getReqCertSANameEmailResolver();
    }

    /**
     * Retrieves the extension pretty print handler.
     *
     * @param e extension
     * @param indent indentation
     * @return extension pretty print handler
     */
    public static IExtPrettyPrint getExtPrettyPrint(Extension e, int indent) {
        return _engine.getExtPrettyPrint(e, indent);
    }
   
    /**
     * Retrieves the certificate pretty print handler.
     *
     * @param delimiter delimiter
     * @return certificate pretty print handler
     */
    public static IPrettyPrintFormat getPrettyPrintFormat(String delimiter) {
        return _engine.getPrettyPrintFormat(delimiter);
    }

    /**
     * Retrieves the CRL pretty print handler.
     *
     * @param crl CRL
     * @return CRL pretty print handler
     */
    public static ICRLPrettyPrint getCRLPrettyPrint(X509CRL crl) {
        return _engine.getCRLPrettyPrint(crl);
    }

    /**
     * Retrieves the CRL cache pretty print handler.
     *
     * @param ip CRL issuing point
     * @return CRL pretty print handler
     */
    public static ICRLPrettyPrint getCRLCachePrettyPrint(ICRLIssuingPoint ip) {
        return _engine.getCRLCachePrettyPrint(ip);
    }

    /**
     * Retrieves the certificate pretty print handler.
     *
     * @param cert certificate
     * @return certificate pretty print handler
     */
    public static ICertPrettyPrint getCertPrettyPrint(X509Certificate cert) {
        return _engine.getCertPrettyPrint(cert);
    }

    public static String getConfigSDSessionId() {
        return _engine.getConfigSDSessionId();
    }

    public static void setConfigSDSessionId(String val) {
        _engine.setConfigSDSessionId(val);
    }

    /**
     * Retrieves the password check.
     *
     * @return default password checker
     */
    public static IPasswordCheck getPasswordChecker() {
        return _engine.getPasswordChecker();
    }

    /**
     * Puts a password entry into the single-sign on cache.
     *
     * @param tag password tag
     * @param pw password
     */
    public static void putPasswordCache(String tag, String pw) {
        _engine.putPasswordCache(tag, pw);
    }

    /**
     * Retrieves the password callback.
     * 
     * @return default password callback
     */
    public static PasswordCallback getPasswordCallback() {
        return _engine.getPasswordCallback();
    }

    /**
     * Retrieves command queue
     *
     * @return command queue
     */
    public static ICommandQueue getCommandQueue() {
        return _engine.getCommandQueue();
    }

    /**
     * Loads the configuration file and starts CMS's core implementation.
     *
     * @param path path to configuration file (CMS.cfg)
     * @exception EBaseException failed to start CMS
     */
    public static void start(String path) throws EBaseException {
        //FileConfigStore mainConfig = null;
/*
        try {
            mainConfig = new FileConfigStore(path);
        } catch (EBaseException e) {
            e.printStackTrace();
            System.out.println(
                "Error: The Server is not fully configured.\n" +
                "Finish configuring server using Configure Setup Wizard in " +
                "the Certificate Server Console.");
            System.out.println(e.toString());
            System.exit(0);
        }
*/

        String classname = "com.netscape.cmscore.apps.CMSEngine";

        CMS cms = null;

        try {
            ICMSEngine engine = (ICMSEngine)
                Class.forName(classname).newInstance();

            cms = new CMS(engine);
            IConfigStore mainConfig = createFileConfigStore(path);
            cms.init(null, mainConfig);
            cms.startup();

        } catch (EBaseException e) { // catch everything here purposely
            CMS.debug("CMS:Caught EBaseException");
			CMS.debug(e);

            // Raidzilla Bug #57592:  Always print error message to stdout.
            System.out.println(e.toString());

            shutdown();
            throw e;
        } catch (Exception e) { // catch everything here purposely 
            ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
            PrintStream ps = new PrintStream(bos); 

            e.printStackTrace(ps);
            System.out.println(Constants.SERVER_SHUTDOWN_MESSAGE);
            throw new EBaseException(bos.toString());
            // cms.shutdown();
        }
    }

    public static IConfigStore createFileConfigStore(String path) throws EBaseException {
        return _engine.createFileConfigStore(path);
    }

    public static IArgBlock createArgBlock() {
        return _engine.createArgBlock();
    }

    public static IArgBlock createArgBlock(String realm, Hashtable httpReq) {
        return _engine.createArgBlock(realm, httpReq);
    }

    public static IArgBlock createArgBlock(Hashtable httpReq) {
        return _engine.createArgBlock(httpReq);
    }

    public static boolean isRevoked(X509Certificate[] certificates) {
        return _engine.isRevoked(certificates);
    }

    public static void setListOfVerifiedCerts(int size, long interval, long unknownStateInterval) {
        _engine.setListOfVerifiedCerts(size, interval, unknownStateInterval);
    }
 
    public static IPasswordStore getPasswordStore() {
        return _engine.getPasswordStore();
    }

    public static ISecurityDomainSessionTable getSecurityDomainSessionTable() {
        return _engine.getSecurityDomainSessionTable();
    }

    /**
     * Main driver to start CMS.
     */
    public static void main(String[] args) {
        String path = CONFIG_FILE;

        for (int i = 0; i < args.length; i++) {
            String arg = args[i];

            if (arg.equals("-f")) {
                path = args[++i];
            } else {
                // ignore unknown arguments since we
                // have no real way to report them
            }
        }
        try {
            start(path);
        } catch (EBaseException e) {
        }
    }
}