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 DV tests
 25  */
 26 
 27 load("tools/TestRunner.js");
 28 load("tools/TestGroup.js");
 29 load("tools/TestProcedure.js");
 30 
 31 load("../cvc.js");
 32 load("../cvcertstore.js");
 33 load("../cvca/cvcca.js");
 34 load("../lib/paconnection.js");
 35 load("../lib/riconnection.js");
 36 load("../lib/taconnection.js");
 37 
 38 
 39 
 40 
 41 /**
 42  * Prompt for a value from persistent configuration
 43  * 
 44  * The new value is stored a configuration item. Backslashes are properly escaped.
 45  * 
 46  * @param {String} text the text to display
 47  * @param {String} id the configuration item
 48  * @param {String} defvalue the default value
 49  * @return the selected value
 50  */
 51 function prompt(text, id, defvalue, list, filter) {
 52 	if (typeof(_scsh3[id]) != "undefined") {
 53 		var value = _scsh3[id];
 54 	} else {
 55 		var value = defvalue;
 56 	}
 57 	var value = Dialog.prompt(text, value, list, filter);
 58 	if (value == null) {
 59 		throw new Error("User abort");
 60 	} else {
 61 		_scsh3.setProperty(id, value.replace(/\\/g, "/"));
 62 	}
 63 	return value;
 64 }
 65 
 66 
 67 
 68 var storePIN = prompt("Enter keystore PIN", "TLSStorePIN", "", null);
 69 
 70 var param = new Array();
 71 
 72 var baseURL = prompt("Enter base URL for services", "DVBaseURL", "", ["https://localhost:8443/se"]);
 73 
 74 
 75 param["crypto"] = new Crypto();
 76 
 77 param["dvcapath"] = null;		// Set by GetCACertificates, if not defined here
 78 param["holderID"] = "UTTEST";
 79 param["cwd"] = GPSystem.mapFilename("", GPSystem.CWD);
 80 param["certstore"] = new CVCertificateStore(param["cwd"] + "/data");
 81 
 82 var ks = new KeyStore("SUN", "jks", "clientkeystore.jks", storePIN);
 83 
 84 param["keystore"] = ks;
 85 param["keystorepasswd"] = storePIN;
 86 param["privateKeyPIN"] = storePIN;
 87 
 88 var ts = new KeyStore("SUN", "jks", "truststore.jks", storePIN);
 89 
 90 param["truststore"] = ts;
 91 
 92 param["baseURL"] = baseURL;
 93 
 94 var c = new URLConnection(baseURL + "/dvca");
 95 c.setTLSKeyStores(ts, ks, storePIN);
 96 param["taURL" ] = c;
 97 
 98 //var c = new URLConnection(baseURL + "/pa");
 99 var c = new URLConnection("http://localhost:8088/mockEAC-DV");
100 c.setTLSKeyStores(ts, ks, storePIN);
101 param["paURL" ] = c;
102 
103 var c = new URLConnection(baseURL + "/ri");
104 c.setTLSKeyStores(ts, ks, storePIN);
105 param["riURL" ] = c;
106 
107 
108 java.lang.System.setProperty("javax.net.debug", "ssl:handshake");
109 
110 
111 var testRunner = new TestRunner("DV Tests");
112 
113 testRunner.addTestProcedureFromXML("tp_cvc.xml");
114 testRunner.addTestGroupFromXML("terminalauth/tg_gc_dvca.xml", param);
115 testRunner.addTestGroupFromXML("passiveauth/tg_gc_masterlist_dv.xml", param);
116 testRunner.addTestGroupFromXML("passiveauth/tg_gc_defectlist_dv.xml", param);
117 testRunner.addTestGroupFromXML("passiveauth/tg_gc_defectlist_dv.xml", param);
118 
119 // testRunner.enable("tg_gc_dvca/011RequestInitialCertificateDVCA", false);
120 
121 print("Test-Suite loaded...");
122