PostIssuance.js

Summary

Post Issuance Functions


Class Summary
PostIssuance  

/**
 *  ---------
 * |.##> <##.|  SmartCard-HSM Support Scripts
 * |#       #|
 * |#       #|  Copyright (c) 2011-2012 CardContact Software & System Consulting
 * |'##> <##'|  Andreas Schwier, 32429 Minden, Germany (www.cardcontact.de)
 *  ---------
 *
 * Consult your license package for usage terms and conditions.
 *
 * @fileoverview Post Issuance Functions
 */


load("keys.js");


function PostIssuance(job) {
	this.job = job;
	this.customerkeys = CustomerKeys;


	this.aid = new ByteString("A000000151000000", HEX);

	this.af = new ApplicationFactory(new Crypto());
	this.af.addApplicationProfile("profiles/ap_jcop_cardmanager.xml");
}

exports.PostIssuance = PostIssuance;

PostIssuance.type = "initializer";



PostIssuance.prototype.handleCard = function(card) {

	card.reset(Card.RESET_COLD);

	var data = {
		applAid: new ByteString("E82B0601040181C31F0201", HEX)
	};

	var dm = {
		get: function(name, fixed, length, encoding) {
			if (typeof(data[name]) == "undefined") {
				return null;
			}

			return data[name];
		}
	}

	var appl = this.af.getApplicationInstance(dm, this.aid, card, this.job.Profile);

	for (var i = 0; i < this.job.Steps.length; i++) {
		appl.key = this.keys;
		appl.run(this.job.Steps[i]);
	}

	return "OK";
}



PostIssuance.prototype.addKey = function(name, value) {
	var key = new Key();
	key.setComponent(Key.DES, value);
	this.keys[name] = key;
}



PostIssuance.prototype.configure = function() {
	this.keys = [];
	this.addKey("KMC", this.customerkeys[this.job.Keys].KMC);
}


Documentation generated by JSDoc on Thu Apr 3 11:32:15 2025