1 /** 2 * --------- 3 * |.##> <##.| Open Smart Card Development Platform (www.openscdp.org) 4 * |# #| 5 * |# #| Copyright (c) 1999-2009 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 SignatureKey - Object storing information related to PrK.QES 25 */ 26 27 28 /** 29 * Create a signature key object 30 * 31 * @class Class implementing signature keys 32 * 33 * @param {String} name the human readable name of the object 34 * @param {Number} id the key id 35 */ 36 function SignatureKey(name, id) { 37 FileSystemIdObject.call(this, name, id); 38 this.isTerminated = true; // State after TERMINATE 39 this.allowTerminate = true; 40 } 41 42 SignatureKey.prototype = new FileSystemIdObject(); 43 SignatureKey.prototype.constructor = SignatureKey; 44 45 46 SignatureKey.TYPE_KEY = "signaturekey"; 47 48 49 /** 50 * Override from base class 51 */ 52 SignatureKey.prototype.getType = function() { 53 return SignatureKey.TYPE_KEY = "signaturekey"; 54 } 55 56 57 58 /** 59 * Terminate authentication object 60 */ 61 SignatureKey.prototype.terminate = function() { 62 if (!this.allowTerminate) { 63 throw new GPError("SignatureKey", GPError.INVALID_DATA, APDU.SW_CONDOFUSENOTSAT, "Terminate not allowed for signature key"); 64 } 65 this.isTerminated = true; 66 } 67 68 69 70 /** 71 * Convert object to a human readable string 72 */ 73 SignatureKey.prototype.toString = function() { 74 return this.name + (this.isTerminated ? " terminated" : " active"); 75 } 76 77 78