1 /** 2 * --------- 3 * |.##> <##.| Open Smart Card Development Platform (www.openscdp.org) 4 * |# #| 5 * |# #| Copyright (c) 1999-2010 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 post a CV-Certificate to a DVCA using a SendCertificates service call 25 */ 26 27 load("../lib/taconnection.js"); 28 load("../cvcertstore.js"); 29 30 31 /** 32 * Prompt for a value from persistent configuration 33 * 34 * The new value is stored a configuration item. Backslashes are properly escaped. 35 * 36 * @param {String} text the text to display 37 * @param {String} id the configuration item 38 * @param {String} defvalue the default value 39 * @return the selected value 40 */ 41 function prompt(text, id, defvalue, filter) { 42 if (typeof(_scsh3[id]) != "undefined") { 43 var value = _scsh3[id]; 44 } else { 45 var value = defvalue; 46 } 47 var value = Dialog.prompt(text, value, null, filter); 48 if (value == null) { 49 throw new Error("User abort"); 50 } else { 51 _scsh3.setProperty(id, value.replace(/\\/g, "/")); 52 } 53 return value; 54 } 55 56 57 58 var url = prompt("Enter the URL of the DVCA service endpoint", "dvcaurl", "http://localhost:8080/se/dvca"); 59 var certfile = prompt("Select certificate", "certfilename", "c:/data", "*.cvcert"); 60 61 var certbin = CVCertificateStore.loadBinaryFile(certfile); 62 63 var dc = new TAConnection(url, false); 64 65 dc.sendCertificates([certbin], "Synchronous", "ok_cert_available"); 66 67