BlackListGenerator.js
Summary
BlackListGenerator - Simple generator for black lists based on TR-03129, Version 1.0
BlackListGenerator.COMPLETE_LIST = new ByteString("00", HEX);
BlackListGenerator.ADDED_LIST = new ByteString("01", HEX);
BlackListGenerator.REMOVED_LIST = new ByteString("02", HEX);
function BlackListGenerator() {
this.content = new ASN1("content", ASN1.SEQUENCE);
}
BlackListGenerator.prototype.reset = function() {
}
BlackListGenerator.prototype.setVersion = function(version) {
this.version = version;
}
BlackListGenerator.prototype.setType = function(type) {
this.type = type;
}
BlackListGenerator.prototype.setListID = function(listID) {
this.listID = listID;
}
BlackListGenerator.prototype.setDeltaBase = function(deltaBase) {
this.deltaBase = deltaBase;
}
BlackListGenerator.prototype.setDeltaBase = function(deltaBase) {
this.deltaBase = deltaBase;
}
BlackListGenerator.prototype.addBlackListDetails = function(sectorID, sectorSpecificIDs) {
var details = new ASN1("BlackListDetails", ASN1.SEQUENCE);
details.add(new ASN1("sectorID", ASN1.OCTET_STRING, new ByteString(sectorID, HEX)));
var ids = new ASN1("sectorSpecificIDs", ASN1.SEQUENCE);
for (var index in sectorSpecificIDs) {
var sectorSpecificID = sectorSpecificIDs[index];
ids.add(new ASN1(ASN1.OCTET_STRING, sectorSpecificID));
}
details.add(ids);
this.content.add(details);
}
BlackListGenerator.prototype.generateBlackList = function() {
var bl = new ASN1(ASN1.SEQUENCE);
bl.add(new ASN1("version", ASN1.INTEGER, new ByteString(this.version, HEX)));
bl.add(new ASN1("type", ASN1.INTEGER, new ByteString(this.type, HEX)));
bl.add(new ASN1("listID", ASN1.OCTET_STRING, new ByteString(this.listID, HEX)));
if (typeof(this.deltaBase) != "undefined") {
bl.add(new ASN1("deltaBase", ASN1.OCTET_STRING, new ByteString(this.deltaBase, HEX)));
}
bl.add(this.content);
return bl.getBytes();
}
Documentation generated by
JSDoc on Tue Sep 3 22:29:38 2013