1 /*
  2  *  ---------
  3  * |.##> <##.|  Open Smart Card Development Platform (www.openscdp.org)
  4  * |#       #|  
  5  * |#       #|  Copyright (c) 1999-2006 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  *  eGK explorer
 25  */
 26 
 27 print("eGK Explorer");
 28 print("============");
 29 
 30 // Load CardOutlineFactory to display card tree
 31 load("tools/CardOutlineFactory.js");
 32 
 33 // Load special classes to display XML encoded fields
 34 load("tools.js");
 35 
 36 // Load Card2CardAuthentication() function
 37 load("c2caut.js");
 38 
 39 
 40 // Create crypto object
 41 var crypto = new Crypto();
 42 
 43 // Create application factory that holds all application profiles
 44 var af = new ApplicationFactory(crypto);
 45 
 46 // Add card application profiles
 47 af.addApplicationProfile("ap_mf.xml");
 48 af.addApplicationProfile("ap_hca.xml");
 49 af.addApplicationProfile("ap_nfd.xml");
 50 af.addApplicationProfile("ap_perserkl.xml");
 51 af.addApplicationProfile("ap_zuzahlung.xml");
 52 af.addApplicationProfile("ap_esign.xml");
 53 af.addApplicationProfile("ap_ciaesign.xml");
 54 af.addApplicationProfile("ap_qes.xml");
 55         
 56 // Create ec-card card object
 57 var card = new Card(_scsh3.reader, "cp_egk.xml");
 58 
 59 // Create card outline factory
 60 var of = new eGKCardOutlineFactory();
 61 
 62 // Create list of AIDs, just in case the EF.DIR is empty
 63 // This is just temporary to make sure the explorer works
 64 // even for card with a defect in EF.DIR
 65 
 66 var aidlist = new Array();
 67 
 68 /* Enable, if EF.DIR is invalid
 69 aidlist.push(new ByteString("D27600000102", HEX));
 70 aidlist.push(new ByteString("A000000167455349474E", HEX));
 71 aidlist.push(new ByteString("E828BD080FA000000167455349474E", HEX));
 72 aidlist.push(new ByteString("D27600006601", HEX));
 73 */
 74 
 75 // and go...
 76 try     {
 77 	var egk = new OutlineCard(of, card, af, aidlist);
 78 	egk.view.setContextMenu(["Verify PIN.CH", "Verify PIN.home"]);
 79 	egk.actionListener = OutlineCardActionListener;
 80 
 81 	print("");
 82 	print("Right click on the eGK node to select PIN verification");
 83 	print("before you select any DF or EF.");
 84 
 85 	egk.view.show();
 86 }
 87 
 88 catch(e) {
 89         print("Problem accessing the card: " + e);
 90 }
 91