1 /**
  2  *  ---------
  3  * |.##> <##.|  Open Smart Card Development Platform (www.openscdp.org)
  4  * |#       #|  
  5  * |#       #|  Copyright (c) 1999-2008 CardContact Software & System Consulting
  6  * |'##> <##'|  Andreas Schwier, 32429 Minden, Germany (www.cardcontact.de)
  7  *  --------- 
  8  *
  9  *  This file is part of OpenSCDP.
 10  *
 11  *  OpenSCDP is free software; you can redistribute it and/or modify
 12  *  it under the terms of the GNU General Public License version 2 as
 13  *  published by the Free Software Foundation.
 14  *
 15  *  OpenSCDP is distributed in the hope that it will be useful,
 16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18  *  GNU General Public License for more details.
 19  *
 20  *  You should have received a copy of the GNU General Public License
 21  *  along with OpenSCDP; if not, write to the Free Software
 22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 23  *
 24  * @fileoverview Script to load all SPOC tests
 25  */
 26 
 27 
 28 load("tools/TestRunner.js");
 29 load("tools/TestGroup.js");
 30 load("tools/TestProcedure.js");
 31 
 32 load("../cvc.js");
 33 load("../cvcertstore.js");
 34 load("../cvca/cvcca.js");
 35 load("../lib/paconnection.js");
 36 load("../lib/riconnection.js");
 37 load("../lib/taconnection.js");
 38 
 39 
 40 
 41 
 42 /**
 43  * Prompt for a value from persistent configuration
 44  * 
 45  * The new value is stored a configuration item. Backslashes are properly escaped.
 46  * 
 47  * @param {String} text the text to display
 48  * @param {String} id the configuration item
 49  * @param {String} defvalue the default value
 50  * @return the selected value
 51  */
 52 function prompt(text, id, defvalue, list, filter) {
 53 	if (typeof(_scsh3[id]) != "undefined") {
 54 		var value = _scsh3[id];
 55 	} else {
 56 		var value = defvalue;
 57 	}
 58 	var value = Dialog.prompt(text, value, list, filter);
 59 	if (value == null) {
 60 		throw new Error("User abort");
 61 	} else {
 62 		_scsh3.setProperty(id, value.replace(/\\/g, "/"));
 63 	}
 64 	return value;
 65 }
 66 
 67 
 68 
 69 var storePIN = prompt("Enter keystore PIN", "TLSStorePIN", "", null);
 70 
 71 var param = new Array();
 72 
 73 var baseURL = prompt("Enter base URL for services", "SPOCBaseURL", "", ["https://localhost:8443/se"]);
 74 
 75 
 76 param["crypto"] = new Crypto();
 77 
 78 param["dvcapath"] = null;		// Set by GetCACertificates, if not defined here
 79 param["holderID"] = "UTTEST";
 80 param["cwd"] = GPSystem.mapFilename("", GPSystem.CWD);
 81 param["certstore"] = new CVCertificateStore(param["cwd"] + "/data");
 82 
 83 var ks = new KeyStore("SUN", "jks", "clientkeystore.jks", storePIN);
 84 
 85 param["keystore"] = ks;
 86 param["keystorepasswd"] = storePIN;
 87 param["privateKeyPIN"] = storePIN;
 88 
 89 var ts = new KeyStore("SUN", "jks", "truststore.jks", storePIN);
 90 
 91 param["truststore"] = ts;
 92 
 93 param["baseURL"] = baseURL;
 94 
 95 var c = new URLConnection(baseURL + "/spoc");
 96 c.setTLSKeyStores(ts, ks, storePIN);
 97 param["taURL" ] = c;
 98 
 99 var c = new URLConnection(baseURL  + "/spoc");
100 c.setTLSKeyStores(ts, ks, storePIN);
101 param["paURL" ] = c;
102 
103 
104 
105 java.lang.System.setProperty("javax.net.debug", "ssl:handshake");
106 
107 
108 var testRunner = new TestRunner("SPOC Tests");
109 
110 testRunner.addTestProcedureFromXML("tp_cvc.xml");
111 testRunner.addTestGroupFromXML("terminalauth/tg_gc_spoc.xml", param);
112 testRunner.addTestGroupFromXML("passiveauth/tg_gc_masterlist_spoc.xml", param);
113 testRunner.addTestGroupFromXML("restrictedID/tg_gc_blacklist_dv.xml", param);
114 
115 // testRunner.enable("tg_gc_dvca/011RequestInitialCertificateDVCA", false);
116 
117 print("Test-Suite loaded...");
118