/* * Copyright (c) 2014, GMO GlobalSign * Copyright (c) 2015, Peculiar Ventures * All rights reserved. * * Author 2014-2015, Yury Strozhevsky <www.strozhevsky.com>. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. *
*/
( function(in_window)
{ //************************************************************************************** // #region Declaration of global variables //************************************************************************************** // #region "org" namespace if(typeof in_window.org === "undefined")
in_window.org = {}; else
{ if(typeof in_window.org !== "object") thrownew Error("Name org already exists and it's not an object");
} // #endregion
// #region "org.pkijs" namespace if(typeof in_window.org.pkijs === "undefined")
in_window.org.pkijs = {}; else
{ if(typeof in_window.org.pkijs !== "object") thrownew Error("Name org.pkijs already exists and it's not an object" + " but " + (typeof in_window.org.pkijs));
} // #endregion
// #region "org.pkijs.simpl" namespace if(typeof in_window.org.pkijs.simpl === "undefined")
in_window.org.pkijs.simpl = {}; else
{ if(typeof in_window.org.pkijs.simpl !== "object") thrownew Error("Name org.pkijs.simpl already exists and it's not an object" + " but " + (typeofin_window.org.pkijs.simpl));
} // #endregion
// #region "org.pkijs.simpl.x509" namespace if(typeof in_window.org.pkijs.simpl.x509 === "undefined")
in_window.org.pkijs.simpl.x509 = {}; else
{ if(typeof in_window.org.pkijs.simpl.x509 !== "object") thrownew Error("Name org.pkijs.simpl.x509 already exists and it's not an object" + " but " + (typeof in_window.org.pkijs.simpl.x509));
} // #endregion
// #region "local" namespace var local = {}; // #endregion //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "Time" type //**************************************************************************************
in_window.org.pkijs.simpl.TIME = function()
{ // #region Internal properties of the object this.type = 0; // 0 - UTCTime; 1 - GeneralizedTime; 2 - empty value this.value = new Date(0, 0, 0); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.TIME.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.type = (arguments[0].type || 0); this.value = (arguments[0].value || (new Date(0, 0, 0)));
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.TIME.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.TIME({
names: {
utcTimeName: "utcTimeName",
generalTimeName: "generalTimeName"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for TIME"); // #endregion
// #region Get internal properties from parsed schema if("utcTimeName" in asn1.result)
{ this.type = 0; this.value = asn1.result.utcTimeName.toDate();
} if("generalTimeName" in asn1.result)
{ this.type = 1; this.value = asn1.result.generalTimeName.toDate();
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.TIME.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object var result = {};
if(this.type === 0)
result = new in_window.org.pkijs.asn1.UTCTIME({ value_date: this.value }); if(this.type === 1)
result = new in_window.org.pkijs.asn1.GENERALIZEDTIME({ value_date: this.value });
return result; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.TIME.prototype.toJSON = function()
{ return {
type: this.type,
value: this.value
};
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "GeneralName" type //**************************************************************************************
in_window.org.pkijs.simpl.GENERAL_NAME = function()
{ // #region Internal properties of the object this.NameType = 9; // Name type - from a tagged value (0 for "otherName", 1 for "rfc822Name" etc.) this.Name = {}; // #endregion
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for GENERAL_NAME"); // #endregion
// #region Get internal properties from parsed schema this.NameType = asn1.result["block_name"].id_block.tag_number;
switch(this.NameType)
{ case 0: // otherName this.Name = asn1.result["block_name"]; break; case 1: // rfc822Name + dNSName + uniformResourceIdentifier case 2: case 6:
{ var value = asn1.result["block_name"];
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "GeneralNames" type //**************************************************************************************
in_window.org.pkijs.simpl.GENERAL_NAMES = function()
{ // #region Internal properties of the object this.names = new Array(); // Array of "org.pkijs.simpl.GENERAL_NAME" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.GENERAL_NAMES.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.names = arguments[0].names || new Array(); // Array of "org.pkijs.simpl.GENERAL_NAME"
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.GENERAL_NAMES.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema, new in_window.org.pkijs.asn1.SEQUENCE({
value: [ new in_window.org.pkijs.asn1.REPEATED({
name: "names",
value: in_window.org.pkijs.schema.GENERAL_NAME()
})
]
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for GENERAL_NAMES"); // #endregion
// #region Get internal properties from parsed schema var n = asn1.result["names"];
for(var i = 0; i < n.length; i++) this.names.push(new in_window.org.pkijs.simpl.GENERAL_NAME({ schema: n[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.GENERAL_NAMES.prototype.toSchema = function(schema)
{ // #region Construct and return new ASN.1 schema for this object var output_array = new Array();
for(var i = 0; i < this.names.length; i++)
output_array.push(this.names[i].toSchema());
return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.GENERAL_NAMES.prototype.toJSON = function()
{ var _names = new Array();
for(var i = 0; i < this.names.length; i++)
_names.push(this.names[i].toJSON());
return {
names: _names
};
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "AlgorithmIdentifier" type //**************************************************************************************
in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER = function()
{ // #region Internal properties of the object this.algorithm_id = ""; // OPTIONAL this.algorithm_params = new in_window.org.pkijs.asn1.NULL(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.algorithm_id = arguments[0].algorithm_id || ""; if("algorithm_params" in arguments[0]) this.algorithm_params = arguments[0].algorithm_params;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER({
names: {
algorithmIdentifier: "algorithm",
algorithmParams: "params"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for ALGORITHM_IDENTIFIER"); // #endregion
// #region Get internal properties from parsed schema this.algorithm_id = asn1.result.algorithm.value_block.toString(); if("params" in asn1.result) this.algorithm_params = asn1.result.params; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for RSASSA_PSS_params"); // #endregion
// #region Get internal properties from parsed schema if("hashAlgorithm" in asn1.result) this.hashAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["hashAlgorithm"] });
if("maskGenAlgorithm" in asn1.result) this.maskGenAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["maskGenAlgorithm"] });
if("saltLength" in asn1.result) this.saltLength = asn1.result["saltLength"].value_block.value_dec;
if("trailerField" in asn1.result) this.trailerField = asn1.result["trailerField"].value_block.value_dec; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.RSASSA_PSS_params.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.RSASSA_PSS_params.prototype.toJSON = function()
{ var _object = {};
if("hashAlgorithm" in this)
_object.hashAlgorithm = this.hashAlgorithm.toJSON();
if("maskGenAlgorithm" in this)
_object.maskGenAlgorithm = this.maskGenAlgorithm.toJSON();
if("saltLength" in this)
_object.saltLength = this.saltLength.toJSON();
if("trailerField" in this)
_object.trailerField = this.trailerField.toJSON();
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "SubjectPublicKeyInfo" type //**************************************************************************************
in_window.org.pkijs.simpl.PUBLIC_KEY_INFO = function()
{ // #region Internal properties of the object this.algorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); this.subjectPublicKey = new in_window.org.pkijs.asn1.BITSTRING(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.PUBLIC_KEY_INFO.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.algorithm = (arguments[0].algorithm || (new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER())); this.subjectPublicKey = (arguments[0].subjectPublicKey || (new in_window.org.pkijs.asn1.BITSTRING()));
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PUBLIC_KEY_INFO.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.PUBLIC_KEY_INFO({
names: {
algorithm: {
names: {
block_name: "algorithm"
}
},
subjectPublicKey: "subjectPublicKey"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PUBLIC_KEY_INFO"); // #endregion
// #region Get internal properties from parsed schema this.algorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result.algorithm }); this.subjectPublicKey = asn1.result.subjectPublicKey; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PUBLIC_KEY_INFO.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [ this.algorithm.toSchema(), this.subjectPublicKey
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PUBLIC_KEY_INFO.prototype.importKey = function(publicKey)
{ /// <param name="publicKey" type="Key">Public key to work with</param>
// #region Initial variables var sequence = Promise.resolve(); var _this = this; // #endregion
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "RelativeDistinguishedName" type //**************************************************************************************
in_window.org.pkijs.simpl.RDN = function()
{ // #region Internal properties of the object /// <field name="types_and_values" type="Array" elementType="in_window.org.pkijs.simpl.ATTR_TYPE_AND_VALUE">Array of "type and value" objects</field> this.types_and_values = new Array(); /// <field name="value_before_decode" type="ArrayBuffer">Value of the RDN before decoding from schema</field> this.value_before_decode = new ArrayBuffer(0); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.RDN.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.types_and_values = (arguments[0].types_and_values || (new Array())); this.value_before_decode = arguments[0].value_before_decode || new ArrayBuffer(0);
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.RDN.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.RDN({
names: {
block_name: "RDN",
repeated_set: "types_and_values"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for RDN"); // #endregion
// #region Get internal properties from parsed schema if("types_and_values" in asn1.result) // Could be a case when there is no "types and values"
{ var types_and_values_array = asn1.result.types_and_values; for(var i = 0; i < types_and_values_array.length; i++) this.types_and_values.push(new in_window.org.pkijs.simpl.ATTR_TYPE_AND_VALUE({ schema: types_and_values_array[i] }));
}
this.value_before_decode = asn1.result.RDN.value_before_decode; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.RDN.prototype.toSchema = function()
{ // #region Decode stored TBS value if(this.value_before_decode.byteLength === 0) // No stored encoded array, create "from scratch"
{ // #region Create array for output set var output_array = new Array();
for(var i = 0; i < this.types_and_values.length; i++)
output_array.push(this.types_and_values[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AuthorityKeyIdentifier.prototype.toJSON = function()
{ var _object = {};
if("keyIdentifier" in this)
_object.keyIdentifier = this.keyIdentifier.toJSON();
if("authorityCertIssuer" in this)
{
_object.authorityCertIssuer = new Array();
for(var i = 0; i < this.authorityCertIssuer.length; i++)
_object.authorityCertIssuer.push(this.authorityCertIssuer[i].toJSON());
}
if("authorityCertSerialNumber" in this)
_object.authorityCertSerialNumber = this.authorityCertSerialNumber.toJSON();
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PrivateKeyUsagePeriod" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod = function()
{ // #region Internal properties of the object // OPTIONAL this.notBefore - new Date() // OPTIONAL this.notAfter - new Date() // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ if("notBefore" in arguments[0]) this.notBefore = arguments[0].notBefore;
if("notAfter" in arguments[0]) this.notAfter = arguments[0].notAfter;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PrivateKeyUsagePeriod({
names: {
notBefore: "notBefore",
notAfter: "notAfter"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PrivateKeyUsagePeriod"); // #endregion
// #region Get internal properties from parsed schema if("notBefore" in asn1.result)
{ var localNotBefore = new in_window.org.pkijs.asn1.GENERALIZEDTIME();
localNotBefore.fromBuffer(asn1.result["notBefore"].value_block.value_hex); this.notBefore = localNotBefore.toDate();
}
if("notAfter" in asn1.result)
{ var localNotAfter = new in_window.org.pkijs.asn1.GENERALIZEDTIME({ value_hex: asn1.result["notAfter"].value_block.value_hex });
localNotAfter.fromBuffer(asn1.result["notAfter"].value_block.value_hex); this.notAfter = localNotAfter.toDate();
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod.prototype.toJSON = function()
{ var _object = {};
if("notBefore" in this)
_object.notBefore = this.notBefore;
if("notAfter" in this)
_object.notAfter = this.notAfter;
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "IssuerAltName" and "SubjectAltName" types of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.AltName = function()
{ // #region Internal properties of the object this.altNames = new Array(); //Array of GeneralName // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.AltName.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.altNames = arguments[0].altNames || new Array();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AltName.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.AltName({
names: {
altNames: "altNames"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for AltName"); // #endregion
// #region Get internal properties from parsed schema if("altNames" in asn1.result)
{ var altNames_array = asn1.result["altNames"];
for(var i = 0; i < altNames_array.length; i++) this.altNames.push(new in_window.org.pkijs.simpl.GENERAL_NAME({ schema: altNames_array[i] }));
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AltName.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.altNames.length; i++)
output_array.push(this.altNames[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AltName.prototype.toJSON = function()
{ var _object = {
altNames: new Array()
};
for(var i = 0; i < this.altNames.length; i++)
_object.altNames.push(this.altNames[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "SubjectDirectoryAttributes" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes = function()
{ // #region Internal properties of the object this.attributes = new Array(); // Array of "simpl.ATTRIBUTE" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.attributes = arguments[0].attributes || new Array(); // Array of "simpl.ATTRIBUTE"
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.SubjectDirectoryAttributes({
names: {
attributes: "attributes"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for SubjectDirectoryAttributes"); // #endregion
// #region Get internal properties from parsed schema var attrs = asn1.result["attributes"];
for(var i = 0; i < attrs.length; i++) this.attributes.push(new in_window.org.pkijs.simpl.ATTRIBUTE({ schema: attrs[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.attributes.length; i++)
output_array.push(this.attributes[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes.prototype.toJSON = function()
{ var _object = {
attributes: new Array()
};
for(var i = 0; i < this.attributes.length; i++)
_object.attributes.push(this.attributes[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PolicyMapping" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMapping = function()
{ // #region Internal properties of the object this.issuerDomainPolicy = ""; this.subjectDomainPolicy = ""; // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PolicyMapping.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.issuerDomainPolicy = arguments[0].issuerDomainPolicy || ""; this.subjectDomainPolicy = arguments[0].subjectDomainPolicy || "";
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMapping.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PolicyMapping({
names: {
issuerDomainPolicy: "issuerDomainPolicy",
subjectDomainPolicy: "subjectDomainPolicy"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PolicyMapping"); // #endregion
// #region Get internal properties from parsed schema this.issuerDomainPolicy = asn1.result["issuerDomainPolicy"].value_block.toString(); this.subjectDomainPolicy = asn1.result["subjectDomainPolicy"].value_block.toString(); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMapping.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [ new in_window.org.pkijs.asn1.OID({ value: this.issuerDomainPolicy }), new in_window.org.pkijs.asn1.OID({ value: this.subjectDomainPolicy })
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMapping.prototype.toJSON = function()
{ return {
issuerDomainPolicy: this.issuerDomainPolicy,
subjectDomainPolicy: this.subjectDomainPolicy
};
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PolicyMappings" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMappings = function()
{ // #region Internal properties of the object this.mappings = new Array(); // Array of "simpl.x509.PolicyMapping" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PolicyMappings.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.mappings = arguments[0].mappings || new Array();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMappings.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PolicyMappings({
names: {
mappings: "mappings"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PolicyMappings"); // #endregion
// #region Get internal properties from parsed schema var maps = asn1.result["mappings"];
for(var i = 0; i < maps.length; i++) this.mappings.push(new in_window.org.pkijs.simpl.x509.PolicyMapping({ schema: maps[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMappings.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.mappings.length; i++)
output_array.push(this.mappings.toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyMappings.prototype.toJSON = function()
{ var _object = {
mappings: new Array()
};
for(var i = 0; i < this.mappings.length; i++)
_object.mappings.push(this.mappings[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "GeneralSubtree" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.GeneralSubtree = function()
{ // #region Internal properties of the object this.base = new in_window.org.pkijs.simpl.GENERAL_NAME(); // OPTIONAL this.minimum // in_window.org.pkijs.asn1.INTEGER // OPTIONAL this.maximum // in_window.org.pkijs.asn1.INTEGER // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.GeneralSubtree.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.base = arguments[0].base || new in_window.org.pkijs.simpl.GENERAL_NAME();
if("minimum" in arguments[0]) this.minimum = arguments[0].minimum;
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "NameConstraints" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.NameConstraints = function()
{ // #region Internal properties of the object // OPTIONAL this.permittedSubtrees - Array of "simpl.x509.GeneralSubtree" // OPTIONAL this.excludedSubtrees - Array of "simpl.x509.GeneralSubtree" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.NameConstraints.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ if("permittedSubtrees" in arguments[0]) this.permittedSubtrees = arguments[0].permittedSubtrees;
if("excludedSubtrees" in arguments[0]) this.excludedSubtrees = arguments[0].excludedSubtrees;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.NameConstraints.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.NameConstraints({
names: {
permittedSubtrees: "permittedSubtrees",
excludedSubtrees: "excludedSubtrees"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for NameConstraints"); // #endregion
// #region Get internal properties from parsed schema if("permittedSubtrees" in asn1.result)
{ this.permittedSubtrees = new Array(); var permited_array = asn1.result["permittedSubtrees"];
for(var i = 0; i < permited_array.length; i++) this.permittedSubtrees.push(new in_window.org.pkijs.simpl.x509.GeneralSubtree({ schema: permited_array[i] }));
}
if("excludedSubtrees" in asn1.result)
{ this.excludedSubtrees = new Array(); var excluded_array = asn1.result["excludedSubtrees"];
for(var i = 0; i < excluded_array.length; i++) this.excludedSubtrees.push(new in_window.org.pkijs.simpl.x509.GeneralSubtree({ schema: excluded_array[i] }));
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.NameConstraints.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
if("permittedSubtrees" in this)
{ var permited_array = new Array();
for(var i = 0; i < this.permittedSubtrees.length; i++)
permited_array.push(this.permittedSubtrees[i].toSchema());
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.NameConstraints.prototype.toJSON = function()
{ var _object = {};
if("permittedSubtrees" in this)
{
_object.permittedSubtrees = new Array();
for(var i = 0; i < this.permittedSubtrees.length; i++)
_object.permittedSubtrees.push(this.permittedSubtrees[i].toJSON());
}
if("excludedSubtrees" in this)
{
_object.excludedSubtrees = new Array();
for(var i = 0; i < this.excludedSubtrees.length; i++)
_object.excludedSubtrees.push(this.excludedSubtrees[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "BasicConstraints" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.BasicConstraints = function()
{ // #region Internal properties of the object // OPTIONAL this.cA - boolean value // OPTIONAL this.pathLenConstraint - integer value // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.BasicConstraints.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ if("cA" in arguments[0]) this.cA = arguments[0].cA;
if("pathLenConstraint" in arguments[0]) this.pathLenConstraint = arguments[0].pathLenConstraint;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.BasicConstraints.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.BasicConstraints({
names: {
cA: "cA",
pathLenConstraint: "pathLenConstraint"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for BasicConstraints"); // #endregion
// #region Get internal properties from parsed schema if("cA" in asn1.result) this.cA = asn1.result["cA"].value_block.value;
if("pathLenConstraint" in asn1.result) this.pathLenConstraint = asn1.result["pathLenConstraint"].value_block.value_dec; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.BasicConstraints.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
if("cA" in this)
output_array.push(new in_window.org.pkijs.asn1.BOOLEAN({ value: this.cA }));
if("pathLenConstraint" in this)
output_array.push(new in_window.org.pkijs.asn1.INTEGER({ value: this.pathLenConstraint })); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.BasicConstraints.prototype.toJSON = function()
{ var _object = {};
if("cA" in this)
_object.cA = this.cA;
if("pathLenConstraint" in this)
_object.pathLenConstraint = this.pathLenConstraint;
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PolicyQualifierInfo" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyQualifierInfo = function()
{ // #region Internal properties of the object this.policyQualifierId = ""; this.qualifier = new in_window.org.pkijs.asn1.ANY(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PolicyQualifierInfo.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.policyQualifierId = arguments[0].policyQualifierId || ""; this.qualifier = arguments[0].qualifier || new in_window.org.pkijs.asn1.ANY();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyQualifierInfo.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PolicyQualifierInfo({
names: {
policyQualifierId: "policyQualifierId",
qualifier: "qualifier"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PolicyQualifierInfo"); // #endregion
// #region Get internal properties from parsed schema this.policyQualifierId = asn1.result["policyQualifierId"].value_block.toString(); this.qualifier = asn1.result["qualifier"]; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyQualifierInfo.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [ new in_window.org.pkijs.asn1.OID({ value: this.policyQualifierId }), this.qualifier
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyQualifierInfo.prototype.toJSON = function()
{ return {
policyQualifierId: this.policyQualifierId,
qualifier: this.qualifier.toJSON()
};
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PolicyInformation" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyInformation = function()
{ // #region Internal properties of the object this.policyIdentifier = ""; // OPTIONAL this.policyQualifiers = new Array(); // Array of "simpl.x509.PolicyQualifierInfo" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PolicyInformation.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.policyIdentifier = arguments[0].policyIdentifier || "";
if("policyQualifiers" in arguments[0]) this.policyQualifiers = arguments[0].policyQualifiers;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyInformation.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PolicyInformation({
names: {
policyIdentifier: "policyIdentifier",
policyQualifiers: "policyQualifiers"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PolicyInformation"); // #endregion
// #region Get internal properties from parsed schema this.policyIdentifier = asn1.result["policyIdentifier"].value_block.toString();
if("policyQualifiers" in asn1.result)
{ this.policyQualifiers = new Array(); var qualifiers = asn1.result["policyQualifiers"];
for(var i = 0; i < qualifiers.length; i++) this.policyQualifiers.push(new in_window.org.pkijs.simpl.x509.PolicyQualifierInfo({ schema: qualifiers[i] }));
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyInformation.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyInformation.prototype.toJSON = function()
{ var _object = {
policyIdentifier: this.policyIdentifier
};
if("policyQualifiers" in this)
{
_object.policyQualifiers = new Array();
for(var i = 0; i < this.policyQualifiers.length; i++)
_object.policyQualifiers.push(this.policyQualifiers[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "CertificatePolicies" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.CertificatePolicies = function()
{ // #region Internal properties of the object this.certificatePolicies = new Array(); // Array of "simpl.x509.PolicyInformation" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.CertificatePolicies.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.certificatePolicies = arguments[0].certificatePolicies || new Array(); // Array of "simpl.x509.PolicyInformation"
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CertificatePolicies.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.CertificatePolicies({
names: {
certificatePolicies: "certificatePolicies"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for CertificatePolicies"); // #endregion
// #region Get internal properties from parsed schema var policies = asn1.result["certificatePolicies"];
for(var i = 0; i < policies.length; i++) this.certificatePolicies.push(new in_window.org.pkijs.simpl.x509.PolicyInformation({ schema: policies[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CertificatePolicies.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.certificatePolicies.length; i++)
output_array.push(this.certificatePolicies[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CertificatePolicies.prototype.toJSON = function()
{ var _object = {
certificatePolicies: new Array()
};
for(var i = 0; i < this.certificatePolicies.length; i++)
_object.certificatePolicies.push(this.certificatePolicies[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "PolicyConstraints" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyConstraints = function()
{ // #region Internal properties of the object // OPTIONAL this.requireExplicitPolicy = 0; // OPTIONAL this.inhibitPolicyMapping = 0; // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.PolicyConstraints.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.requireExplicitPolicy = arguments[0].requireExplicitPolicy || 0; this.inhibitPolicyMapping = arguments[0].inhibitPolicyMapping || 0;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyConstraints.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.PolicyConstraints({
names: {
requireExplicitPolicy: "requireExplicitPolicy",
inhibitPolicyMapping: "inhibitPolicyMapping"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PolicyConstraints"); // #endregion
// #region Get internal properties from parsed schema if("requireExplicitPolicy" in asn1.result)
{ var field1 = asn1.result["requireExplicitPolicy"];
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.PolicyConstraints.prototype.toJSON = function()
{ var _object = {};
if("requireExplicitPolicy" in this)
_object.requireExplicitPolicy = this.requireExplicitPolicy;
if("inhibitPolicyMapping" in this)
_object.inhibitPolicyMapping = this.inhibitPolicyMapping;
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "ExtKeyUsage" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.ExtKeyUsage = function()
{ // #region Internal properties of the object this.keyPurposes = new Array(); // Array of strings (OIDs value for key purposes) // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.ExtKeyUsage.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.keyPurposes = arguments[0].keyPurposes || new Array(); // Array of strings (OIDs value for key purposes)
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.ExtKeyUsage.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.ExtKeyUsage({
names: {
keyPurposes: "keyPurposes"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for ExtKeyUsage"); // #endregion
// #region Get internal properties from parsed schema var purposes = asn1.result["keyPurposes"];
for(var i = 0; i < purposes.length; i++) this.keyPurposes.push(purposes[i].value_block.toString()); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.ExtKeyUsage.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.keyPurposes.length; i++)
output_array.push(new in_window.org.pkijs.asn1.OID({ value: this.keyPurposes[i] })); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.ExtKeyUsage.prototype.toJSON = function()
{ var _object = {
keyPurposes: new Array()
};
for(var i = 0; i < this.keyPurposes.length; i++)
_object.keyPurposes.push(this.keyPurposes[i]);
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "DistributionPoint" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.DistributionPoint = function()
{ // #region Internal properties of the object // OPTIONAL this.distributionPoint // Array of "simpl.GENERAL_NAME" or a value of "simpl.RDN" type // OPTIONAL this.reasons // BITSTRING value // OPTIONAL this.cRLIssuer // Array of "simpl.GENERAL_NAME" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.DistributionPoint.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ if("distributionPoint" in arguments[0]) this.distributionPoint = arguments[0].distributionPoint;
if("reasons" in arguments[0]) this.reasons = arguments[0].reasons;
if("cRLIssuer" in this)
{ var value = new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
id_block: {
tag_class: 3, // CONTEXT-SPECIFIC
tag_number: 2 // [2]
}
});
for(var i = 0; i < this.cRLIssuer.length; i++)
value.value_block.value.push(this.cRLIssuer[i].toSchema());
output_array.push(value);
} // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.DistributionPoint.prototype.toJSON = function()
{ var _object = {};
if("distributionPoint" in this)
{ if(this.distributionPoint instanceof Array)
{
_object.distributionPoint = new Array();
for(var i = 0; i < this.distributionPoint.length; i++)
_object.distributionPoint.push(this.distributionPoint[i].toJSON());
} else
_object.distributionPoint = this.distributionPoint.toJSON();
}
if("reasons" in this)
_object.reasons = this.reasons.toJSON();
if("cRLIssuer" in this)
{
_object.cRLIssuer = new Array();
for(var i = 0; i < this.cRLIssuer.length; i++)
_object.cRLIssuer.push(this.cRLIssuer[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "CRLDistributionPoints" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.CRLDistributionPoints = function()
{ // #region Internal properties of the object this.distributionPoints = new Array(); // Array of "simpl.x509.DistributionPoint" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.CRLDistributionPoints.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.distributionPoints = arguments[0].distributionPoints || new Array(); // Array of "simpl.x509.DistributionPoint"
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CRLDistributionPoints.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.CRLDistributionPoints({
names: {
distributionPoints: "distributionPoints"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for CRLDistributionPoints"); // #endregion
// #region Get internal properties from parsed schema var points = asn1.result["distributionPoints"];
for(var i = 0; i < points.length; i++) this.distributionPoints.push(new in_window.org.pkijs.simpl.x509.DistributionPoint({ schema: points[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CRLDistributionPoints.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.distributionPoints.length; i++)
output_array.push(this.distributionPoints[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.CRLDistributionPoints.prototype.toJSON = function()
{ var _object = {
distributionPoints: new Array()
};
for(var i = 0; i < this.distributionPoints.length; i++)
_object.distributionPoints.push(this.distributionPoints[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "AccessDescription" type //**************************************************************************************
in_window.org.pkijs.simpl.x509.AccessDescription = function()
{ // #region Internal properties of the object this.accessMethod = ""; this.accessLocation = new in_window.org.pkijs.simpl.GENERAL_NAME(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.AccessDescription.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.accessMethod = arguments[0].accessMethod || ""; this.accessLocation = arguments[0].accessLocation || new in_window.org.pkijs.simpl.GENERAL_NAME();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AccessDescription.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.AccessDescription({
names: {
accessMethod: "accessMethod",
accessLocation: {
names: {
block_name: "accessLocation"
}
}
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for AccessDescription"); // #endregion
// #region Get internal properties from parsed schema this.accessMethod = asn1.result["accessMethod"].value_block.toString(); this.accessLocation = new in_window.org.pkijs.simpl.GENERAL_NAME({ schema: asn1.result["accessLocation"] }); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AccessDescription.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [ new in_window.org.pkijs.asn1.OID({ value: this.accessMethod }), this.accessLocation.toSchema()
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.AccessDescription.prototype.toJSON = function()
{ return {
accessMethod: this.accessMethod,
accessLocation: this.accessLocation.toJSON()
};
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "AuthorityInfoAccess" and "SubjectInfoAccess" types of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.InfoAccess = function()
{ // #region Internal properties of the object this.accessDescriptions = new Array(); // Array of "simpl.x509.AccessDescription" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.InfoAccess.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.accessDescriptions = arguments[0].accessDescriptions || new Array(); // Array of "simpl.x509.DistributionPoint"
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.InfoAccess.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.x509.InfoAccess({
names: {
accessDescriptions: "accessDescriptions"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for InfoAccess"); // #endregion
// #region Get internal properties from parsed schema var descriptions = asn1.result["accessDescriptions"];
for(var i = 0; i < descriptions.length; i++) this.accessDescriptions.push(new in_window.org.pkijs.simpl.x509.AccessDescription({ schema: descriptions[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.InfoAccess.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
for(var i = 0; i < this.accessDescriptions.length; i++)
output_array.push(this.accessDescriptions[i].toSchema()); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.InfoAccess.prototype.toJSON = function()
{ var _object = {
accessDescriptions: new Array()
};
for(var i = 0; i < this.accessDescriptions.length; i++)
_object.accessDescriptions.push(this.accessDescriptions[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "IssuingDistributionPoint" type of extension //**************************************************************************************
in_window.org.pkijs.simpl.x509.IssuingDistributionPoint = function()
{ // #region Internal properties of the object // OPTIONAL this.distributionPoint // Array of "simpl.GENERAL_NAME" or a value of "simpl.RDN" type // OPTIONAL this.onlyContainsUserCerts // BOOLEAN flag // OPTIONAL this.onlyContainsCACerts // BOOLEAN flag // OPTIONAL this.onlySomeReasons // BITSTRING // OPTIONAL this.indirectCRL // BOOLEAN flag // OPTIONAL this.onlyContainsAttributeCerts // BOOLEAN flag // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.x509.IssuingDistributionPoint.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ if("distributionPoint" in arguments[0]) this.distributionPoint = arguments[0].distributionPoint;
if("onlyContainsUserCerts" in arguments[0]) this.onlyContainsUserCerts = arguments[0].onlyContainsUserCerts;
if("onlyContainsCACerts" in arguments[0]) this.onlyContainsCACerts = arguments[0].onlyContainsCACerts;
if("onlySomeReasons" in arguments[0]) this.onlySomeReasons = arguments[0].onlySomeReasons;
if("indirectCRL" in arguments[0]) this.indirectCRL = arguments[0].indirectCRL;
this.distributionPoint = new in_window.org.pkijs.simpl.RDN({ schema: asn1.result["distributionPoint"] });
}
}
if("onlyContainsUserCerts" in asn1.result)
{ var view = new Uint8Array(asn1.result["onlyContainsUserCerts"].value_block.value_hex); this.onlyContainsUserCerts = (view[0] !== 0x00);
}
if("onlyContainsCACerts" in asn1.result)
{ var view = new Uint8Array(asn1.result["onlyContainsCACerts"].value_block.value_hex); this.onlyContainsCACerts = (view[0] !== 0x00);
}
if("onlySomeReasons" in asn1.result)
{ var view = new Uint8Array(asn1.result["onlySomeReasons"].value_block.value_hex); this.onlySomeReasons = view[0];
}
if("indirectCRL" in asn1.result)
{ var view = new Uint8Array(asn1.result["indirectCRL"].value_block.value_hex); this.indirectCRL = (view[0] !== 0x00);
}
if("onlyContainsAttributeCerts" in asn1.result)
{ var view = new Uint8Array(asn1.result["onlyContainsAttributeCerts"].value_block.value_hex); this.onlyContainsAttributeCerts = (view[0] !== 0x00);
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.IssuingDistributionPoint.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
if("distributionPoint" in this)
{ var value;
if(this.distributionPoint instanceof Array)
{
value = new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
id_block: {
tag_class: 3, // CONTEXT-SPECIFIC
tag_number: 0 // [0]
}
});
for(var i = 0; i < this.distributionPoint.length; i++)
value.value_block.value.push(this.distributionPoint[i].toSchema());
} else
{
value = this.distributionPoint.toSchema();
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.x509.IssuingDistributionPoint.prototype.toJSON = function()
{ var _object = {};
if("distributionPoint" in this)
{ if(this.distributionPoint instanceof Array)
{
_object.distributionPoint = new Array();
for(var i = 0; i < this.distributionPoint.length; i++)
_object.distributionPoint.push(this.distributionPoint[i].toJSON());
} else
_object.distributionPoint = this.distributionPoint.toJSON();
}
if("onlyContainsUserCerts" in this)
_object.onlyContainsUserCerts = this.onlyContainsUserCerts;
if("onlyContainsCACerts" in this)
_object.onlyContainsCACerts = this.onlyContainsCACerts;
if("onlySomeReasons" in this)
_object.onlySomeReasons = this.onlySomeReasons.toJSON();
if("indirectCRL" in this)
_object.indirectCRL = this.indirectCRL;
if("onlyContainsAttributeCerts" in this)
_object.onlyContainsAttributeCerts = this.onlyContainsAttributeCerts;
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "Extension" type //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSION = function()
{ // #region Internal properties of the object this.extnID = ""; this.critical = false; this.extnValue = new in_window.org.pkijs.asn1.OCTETSTRING();
// OPTIONAL this.parsedValue - Parsed "extnValue" in case of well-known "extnID" // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.EXTENSION.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.extnID = (arguments[0].extnID || ""); this.critical = (arguments[0].critical || false); if("extnValue" in arguments[0]) this.extnValue = new in_window.org.pkijs.asn1.OCTETSTRING({ value_hex: arguments[0].extnValue }); else this.extnValue = new in_window.org.pkijs.asn1.OCTETSTRING();
if("parsedValue" in arguments[0]) this.parsedValue = arguments[0].parsedValue;
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSION.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.EXTENSION({
names: {
extnID: "extnID",
critical: "critical",
extnValue: "extnValue"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for EXTENSION"); // #endregion
// #region Get internal properties from parsed schema this.extnID = asn1.result.extnID.value_block.toString(); if("critical" in asn1.result) this.critical = asn1.result.critical.value_block.value; this.extnValue = asn1.result.extnValue;
// #region Get "parsedValue" for well-known extensions var asn1 = in_window.org.pkijs.fromBER(this.extnValue.value_block.value_hex); if(asn1.offset === (-1)) return;
switch(this.extnID)
{ case"2.5.29.9": // SubjectDirectoryAttributes this.parsedValue = new in_window.org.pkijs.simpl.x509.SubjectDirectoryAttributes({ schema: asn1.result }); break; case"2.5.29.14": // SubjectKeyIdentifier this.parsedValue = asn1.result; // Should be just a simple OCTETSTRING break; case"2.5.29.15": // KeyUsage this.parsedValue = asn1.result; // Should be just a simple BITSTRING break; case"2.5.29.16": // PrivateKeyUsagePeriod this.parsedValue = new in_window.org.pkijs.simpl.x509.PrivateKeyUsagePeriod({ schema: asn1.result }); break; case"2.5.29.17": // SubjectAltName case"2.5.29.18": // IssuerAltName this.parsedValue = new in_window.org.pkijs.simpl.x509.AltName({ schema: asn1.result }); break; case"2.5.29.19": // BasicConstraints this.parsedValue = new in_window.org.pkijs.simpl.x509.BasicConstraints({ schema: asn1.result }); break; case"2.5.29.20": // CRLNumber case"2.5.29.27": // BaseCRLNumber (delta CRL indicator) this.parsedValue = asn1.result; // Should be just a simple INTEGER break; case"2.5.29.21": // CRLReason this.parsedValue = asn1.result; // Should be just a simple ENUMERATED break; case"2.5.29.24": // InvalidityDate this.parsedValue = asn1.result; // Should be just a simple GeneralizedTime break; case"2.5.29.28": // IssuingDistributionPoint this.parsedValue = new in_window.org.pkijs.simpl.x509.IssuingDistributionPoint({ schema: asn1.result }); break; case"2.5.29.29": // CertificateIssuer this.parsedValue = new in_window.org.pkijs.simpl.GENERAL_NAMES({ schema: asn1.result }); // Should be just a simple break; case"2.5.29.30": // NameConstraints this.parsedValue = new in_window.org.pkijs.simpl.x509.NameConstraints({ schema: asn1.result }); break; case"2.5.29.31": // CRLDistributionPoints case"2.5.29.46": // FreshestCRL this.parsedValue = new in_window.org.pkijs.simpl.x509.CRLDistributionPoints({ schema: asn1.result }); break; case"2.5.29.32": // CertificatePolicies this.parsedValue = new in_window.org.pkijs.simpl.x509.CertificatePolicies({ schema: asn1.result }); break; case"2.5.29.33": // PolicyMappings this.parsedValue = new in_window.org.pkijs.simpl.x509.PolicyMappings({ schema: asn1.result }); break; case"2.5.29.35": // AuthorityKeyIdentifier this.parsedValue = new in_window.org.pkijs.simpl.x509.AuthorityKeyIdentifier({ schema: asn1.result }); break; case"2.5.29.36": // PolicyConstraints this.parsedValue = new in_window.org.pkijs.simpl.x509.PolicyConstraints({ schema: asn1.result }); break; case"2.5.29.37": // ExtKeyUsage this.parsedValue = new in_window.org.pkijs.simpl.x509.ExtKeyUsage({ schema: asn1.result }); break; case"2.5.29.54": // InhibitAnyPolicy this.parsedValue = asn1.result; // Should be just a simple INTEGER break; case"1.3.6.1.5.5.7.1.1": // AuthorityInfoAccess case"1.3.6.1.5.5.7.1.11": // SubjectInfoAccess this.parsedValue = new in_window.org.pkijs.simpl.x509.InfoAccess({ schema: asn1.result }); break; default:
} // #endregion // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSION.prototype.toSchema = function()
{ // #region Create array for output sequence var output_array = new Array();
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSION.prototype.toJSON = function()
{ var _object = {
extnID: this.extnID,
critical: this.critical,
extnValue: this.extnValue.toJSON()
};
if("parsedValue" in this)
_object.parsedValue = this.parsedValue.toJSON();
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "Extensions" type (sequence of many Extension) //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSIONS = function()
{ // #region Internal properties of the object this.extensions_array = new Array(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.EXTENSIONS.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object) this.extensions_array = (arguments[0].extensions_array || (new Array()));
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSIONS.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.EXTENSIONS({
names: {
extensions: "extensions"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for EXTENSIONS"); // #endregion
// #region Get internal properties from parsed schema for(var i = 0; i < asn1.result.extensions.length; i++) this.extensions_array.push(new in_window.org.pkijs.simpl.EXTENSION({ schema: asn1.result.extensions[i] })); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSIONS.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object var extension_schemas = new Array();
for(var i = 0; i < this.extensions_array.length; i++)
extension_schemas.push(this.extensions_array[i].toSchema());
return (new in_window.org.pkijs.asn1.SEQUENCE({
value: extension_schemas
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.EXTENSIONS.prototype.toJSON = function()
{ var _object = {
extensions_array: new Array()
};
for(var i = 0; i < this.extensions_array.length; i++)
_object.extensions_array.push(this.extensions_array[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for X.509 v3 certificate (RFC5280) //**************************************************************************************
in_window.org.pkijs.simpl.CERT = function()
{ // #region Internal properties of the object // #region Properties from certificate TBS part this.tbs = new ArrayBuffer(0); // Encoded value of certificate TBS (need to have it for certificate validation)
// OPTIONAL this.version = 0; this.serialNumber = new in_window.org.pkijs.asn1.INTEGER(); // Might be a very long integer value this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate TBS part this.issuer = new in_window.org.pkijs.simpl.RDN(); this.notBefore = new in_window.org.pkijs.simpl.TIME(); this.notAfter = new in_window.org.pkijs.simpl.TIME(); this.subject = new in_window.org.pkijs.simpl.RDN(); this.subjectPublicKeyInfo = new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO(); // OPTIONAL this.issuerUniqueID = new ArrayBuffer(0); // IMPLICIT bistring value // OPTIONAL this.subjectUniqueID = new ArrayBuffer(0); // IMPLICIT bistring value // OPTIONAL this.extensions = new Array(); // Array of "simpl.EXTENSION" // #endregion
// #region Properties from certificate major part this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate major part this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING(); // #endregion // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.CERT.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ // #region Properties from certificate TBS part this.tbs = arguments[0].tbs || new ArrayBuffer(0);
if("version" in arguments[0]) this.version = arguments[0].version; this.serialNumber = arguments[0].serialNumber || new in_window.org.pkijs.asn1.INTEGER(); // Might be a very long integer value this.signature = arguments[0].signature || new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate TBS part this.issuer = arguments[0].issuer || new in_window.org.pkijs.simpl.RDN(); this.notBefore = arguments[0].not_before || new in_window.org.pkijs.simpl.TIME(); this.notAfter = arguments[0].not_after || new in_window.org.pkijs.simpl.TIME(); this.subject = arguments[0].subject || new in_window.org.pkijs.simpl.RDN(); this.subjectPublicKeyInfo = arguments[0].subjectPublicKeyInfo || new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO(); if("issuerUniqueID" in arguments[0]) this.issuerUniqueID = arguments[0].issuerUniqueID; if("subjectUniqueID" in arguments[0]) this.subjectUniqueID = arguments[0].subjectUniqueID; if("extensions" in arguments[0]) this.extensions = arguments[0].extensions; // #endregion
// #region Properties from certificate major part this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate major part this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING(); // #endregion
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.CERT({
names: {
tbsCertificate: {
names: {
extensions: {
names: {
extensions: "tbsCertificate.extensions"
}
}
}
}
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for CERT"); // #endregion
// #region Get internal properties from parsed schema this.tbs = asn1.result["tbsCertificate"].value_before_decode;
if("tbsCertificate.version" in asn1.result) this.version = asn1.result["tbsCertificate.version"].value_block.value_dec; this.serialNumber = asn1.result["tbsCertificate.serialNumber"]; this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["tbsCertificate.signature"] }); this.issuer = new in_window.org.pkijs.simpl.RDN({ schema: asn1.result["tbsCertificate.issuer"] }); this.notBefore = new in_window.org.pkijs.simpl.TIME({ schema: asn1.result["tbsCertificate.notBefore"] }); this.notAfter = new in_window.org.pkijs.simpl.TIME({ schema: asn1.result["tbsCertificate.notAfter"] }); this.subject = new in_window.org.pkijs.simpl.RDN({ schema: asn1.result["tbsCertificate.subject"] }); this.subjectPublicKeyInfo = new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO({ schema: asn1.result["tbsCertificate.subjectPublicKeyInfo"] }); if("tbsCertificate.issuerUniqueID" in asn1.result) this.issuerUniqueID = asn1.result["tbsCertificate.issuerUniqueID"].value_block.value_hex; if("tbsCertificate.subjectUniqueID" in asn1.result) this.issuerUniqueID = asn1.result["tbsCertificate.subjectUniqueID"].value_block.value_hex; if("tbsCertificate.extensions" in asn1.result)
{ this.extensions = new Array();
var extensions = asn1.result["tbsCertificate.extensions"];
for(var i = 0; i < extensions.length; i++) this.extensions.push(new in_window.org.pkijs.simpl.EXTENSION({ schema: extensions[i] }));
}
this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["signatureAlgorithm"] }); this.signatureValue = asn1.result["signatureValue"]; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT.prototype.encodeTBS = function()
{ /// <summary>Create ASN.1 schema for existing values of TBS part for the certificate</summary>
// #region Create array for output sequence var output_array = new Array();
// #region Decode stored TBS value if(encodeFlag === false)
{ if(this.tbs.length === 0) // No stored certificate TBS part return in_window.org.pkijs.schema.CERT().value[0];
var tbs_asn1 = in_window.org.pkijs.fromBER(this.tbs);
tbs_schema = tbs_asn1.result;
} // #endregion // #region Create TBS schema via assembling from TBS parts else
tbs_schema = in_window.org.pkijs.simpl.CERT.prototype.encodeTBS.call(this); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [
tbs_schema, this.signatureAlgorithm.toSchema(), this.signatureValue
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT.prototype.verify = function()
{ /// <summary>!!! Works well in Chrome dev versions only (April 2014th) !!!</summary> /// <returns type="Promise">Returns a new Promise object (in case of error), or a result of "crypto.subtle.veryfy" function</returns>
// #region Global variables var sequence = Promise.resolve();
var subjectPublicKeyInfo = {};
var signature = this.signatureValue; var tbs = this.tbs;
var _this = this; // #endregion
// #region Set correct "subjectPublicKeyInfo" value if(arguments[0] instanceof Object)
{ if("issuerCertificate" in arguments[0]) // Must be of type "simpl.CERT"
subjectPublicKeyInfo = arguments[0].issuerCertificate.subjectPublicKeyInfo;
} else
{ if(this.issuer.isEqual(this.subject)) // Self-signed certificate
subjectPublicKeyInfo = this.subjectPublicKeyInfo;
}
if((subjectPublicKeyInfo instanceof in_window.org.pkijs.simpl.PUBLIC_KEY_INFO) === false) returnnew Promise(function(resolve, reject) { reject("Please provide issuer certificate as a parameter"); }); // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Importing public key
sequence = sequence.then( function()
{ // #region Get information about public key algorithm and default parameters for import var algorithmObject = in_window.org.pkijs.getAlgorithmByOID(_this.signatureAlgorithm.algorithm_id); if(("name" in algorithmObject) === false) returnnew Promise(function(resolve, reject) { reject("Unsupported public key algorithm: " + _this.signatureAlgorithm.algorithm_id); });
var algorithm_name = algorithmObject.name;
var algorithm = in_window.org.pkijs.getAlgorithmParameters(algorithm_name, "importkey"); if("hash" in algorithm.algorithm)
algorithm.algorithm.hash.name = sha_algorithm; // #endregion
var publicKeyInfo_schema = subjectPublicKeyInfo.toSchema(); var publicKeyInfo_buffer = publicKeyInfo_schema.toBER(false); var publicKeyInfo_view = new Uint8Array(publicKeyInfo_buffer);
// #region Initial variables var _this = this; // #endregion
// #region Get a private key from function parameter if(typeof privateKey === "undefined") returnnew Promise(function(resolve, reject) { reject("Need to provide a private key for signing"); }); // #endregion
// #region Get a "default parameters" for current algorithm var defParams = in_window.org.pkijs.getAlgorithmParameters(privateKey.algorithm.name, "sign");
defParams.algorithm.hash.name = hashAlgorithm; // #endregion
// #region Fill internal structures base on "privateKey" and "hashAlgorithm" switch(privateKey.algorithm.name.toUpperCase())
{ case"RSASSA-PKCS1-V1_5": case"ECDSA":
_this.signature.algorithm_id = in_window.org.pkijs.getOIDByAlgorithm(defParams.algorithm);
_this.signatureAlgorithm.algorithm_id = _this.signature.algorithm_id; break; case"RSA-PSS":
{ // #region Set "saltLength" as a length (in octets) of hash function result switch(hashAlgorithm.toUpperCase())
{ case"SHA-256":
defParams.algorithm.saltLength = 32; break; case"SHA-384":
defParams.algorithm.saltLength = 48; break; case"SHA-512":
defParams.algorithm.saltLength = 64; break; default:
} // #endregion
// #region Fill "RSASSA_PSS_params" object var paramsObject = {};
paramsObject.hashAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({
algorithm_id: hashAlgorithmOID,
algorithm_params: new in_window.org.pkijs.asn1.NULL()
});
var pssParameters = new in_window.org.pkijs.simpl.x509.RSASSA_PSS_params(paramsObject); // #endregion
// #region Automatically set signature algorithm
_this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({
algorithm_id: "1.2.840.113549.1.1.10",
algorithm_params: pssParameters.toSchema()
});
_this.signatureAlgorithm = _this.signature; // Must be the same // #endregion
} break; default: returnnew Promise(function(resolve, reject) { reject("Unsupported signature algorithm: " + privateKey.algorithm.name); });
} // #endregion
// #region Create TBS data for signing
_this.tbs = in_window.org.pkijs.simpl.CERT.prototype.encodeTBS.call(this).toBER(false); // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Signing TBS data on provided private key return crypto.sign(defParams.algorithm,
privateKey, new Uint8Array(_this.tbs)).then( function(result)
{ // #region Special case for ECDSA algorithm if(defParams.algorithm.name === "ECDSA")
result = in_window.org.pkijs.createCMSECDSASignature(result); // #endregion
_this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING({ value_hex: result });
}, function(error)
{ returnnew Promise(function(resolve, reject) { reject("Signing error: " + error); });
}
); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT.prototype.getPublicKey = function()
{ /// <summary>Importing public key for current certificate</summary>
// #region Initial variables var algorithm; // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Get information about public key algorithm and default parameters for import var algorithmObject = in_window.org.pkijs.getAlgorithmByOID(this.signatureAlgorithm.algorithm_id); if(("name" in algorithmObject) === false) returnnew Promise(function(resolve, reject) { reject("Unsupported public key algorithm: " + _this.signatureAlgorithm.algorithm_id); });
// #region Get neccessary values from internal fields for current certificate var publicKeyInfo_schema = this.subjectPublicKeyInfo.toSchema(); var publicKeyInfo_buffer = publicKeyInfo_schema.toBER(false); var publicKeyInfo_view = new Uint8Array(publicKeyInfo_buffer); // #endregion
return crypto.importKey("spki", publicKeyInfo_view, algorithm.algorithm, true, algorithm.usages);
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT.prototype.getKeyHash = function()
{ /// <summary>Get SHA-1 hash value for subject public key</summary>
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: sequence_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.REV_CERT.prototype.toJSON = function()
{ var _object = {
userCertificate: this.userCertificate.toJSON(),
revocationDate: this.revocationDate.toJSON
};
if("crlEntryExtensions" in this)
{
_object.crlEntryExtensions = new Array();
for(var i = 0; i < this.crlEntryExtensions.length; i++)
_object.crlEntryExtensions.push(this.crlEntryExtensions[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for X.509 CRL (Certificate Revocation List)(RFC5280) //**************************************************************************************
in_window.org.pkijs.simpl.CRL = function()
{ // #region Internal properties of the object // #region Properties from CRL TBS part this.tbs = new ArrayBuffer(0);
// OPTIONAL this.version = 1; this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); this.issuer = new in_window.org.pkijs.simpl.RDN(); this.thisUpdate = new in_window.org.pkijs.simpl.TIME(); // OPTIONAL this.nextUpdate = new in_window.org.pkijs.simpl.TIME(); // OPTIONAL this.revokedCertificates = new Array(); // Array of REV_CERT objects // OPTIONAL this.crlExtensions = new Array(); // Array of in_window.org.pkijs.simpl.EXTENSION(); // #endregion
// #region Properties from CRL major part this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING(); // #endregion // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.CRL.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ // #region Properties from CRL TBS part this.tbs = arguments[0].tbs || new ArrayBuffer(0);
if("version" in arguments[0]) this.version = arguments[0].version; this.signature = arguments[0].signature || new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); this.issuer = arguments[0].issuer || new in_window.org.pkijs.simpl.RDN(); this.thisUpdate = arguments[0].thisUpdate || new in_window.org.pkijs.simpl.TIME(); if("nextUpdate" in arguments[0]) this.nextUpdate = arguments[0].nextUpdate; if("revokedCertificates" in arguments[0]) this.revokedCertificates = arguments[0].revokedCertificates; if("crlExtensions" in arguments[0]) this.crlExtensions = arguments[0].crlExtensions; // #endregion
// #region Properties from CRL major part this.signatureAlgorithm = arguments[0].signatureAlgorithm || new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); this.signatureValue = arguments[0].signatureValue || new in_window.org.pkijs.asn1.BITSTRING(); // #endregion
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CRL.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.CRL()
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for CRL"); // #endregion
// #region Get internal properties from parsed schema this.tbs = asn1.result["tbsCertList"].value_before_decode;
if("tbsCertList.version" in asn1.result) this.version = asn1.result["tbsCertList.version"].value_block.value_dec; this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["tbsCertList.signature"] }); this.issuer = new in_window.org.pkijs.simpl.RDN({ schema: asn1.result["tbsCertList.issuer"] }); this.thisUpdate = new in_window.org.pkijs.simpl.TIME({ schema: asn1.result["tbsCertList.thisUpdate"] }); if("tbsCertList.nextUpdate" in asn1.result) this.nextUpdate = new in_window.org.pkijs.simpl.TIME({ schema: asn1.result["tbsCertList.nextUpdate"] }); if("tbsCertList.revokedCertificates" in asn1.result)
{ this.revokedCertificates = new Array();
var rev_certs = asn1.result["tbsCertList.revokedCertificates"]; for(var i = 0; i < rev_certs.length; i++) this.revokedCertificates.push(new in_window.org.pkijs.simpl.REV_CERT({ schema: rev_certs[i] }));
} if("tbsCertList.extensions" in asn1.result)
{ this.crlExtensions = new Array(); var exts = asn1.result["tbsCertList.extensions"].value_block.value;
for(var i = 0; i < exts.length; i++) this.crlExtensions.push(new in_window.org.pkijs.simpl.EXTENSION({ schema: exts[i] }));
}
this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["signatureAlgorithm"] }); this.signatureValue = asn1.result["signatureValue"]; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CRL.prototype.encodeTBS = function()
{ // #region Create array for output sequence var output_array = new Array();
if("version" in this)
output_array.push(new in_window.org.pkijs.asn1.INTEGER({ value: this.version }));
return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
}));
}; //**************************************************************************************
in_window.org.pkijs.simpl.CRL.prototype.toSchema = function(encodeFlag)
{ /// <param name="encodeFlag" type="Boolean">If param equal to false then create TBS schema via decoding stored value. In othe case create TBS schema via assembling from TBS parts.</param>
// #region Decode stored TBS value var tbs_schema;
if(encodeFlag === false)
{ if(this.tbs.length === 0) // No stored TBS part return in_window.org.pkijs.schema.CRL();
tbs_schema = in_window.org.pkijs.fromBER(this.tbs).result;
} // #endregion // #region Create TBS schema via assembling from TBS parts else
tbs_schema = in_window.org.pkijs.simpl.CRL.prototype.encodeTBS.call(this); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [
tbs_schema, this.signatureAlgorithm.toSchema(), this.signatureValue
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CRL.prototype.verify = function()
{ // #region Global variables var sequence = Promise.resolve();
var signature = this.signatureValue; var tbs = this.tbs;
var subjectPublicKeyInfo = -1;
var _this = this; // #endregion
// #region Get information about CRL issuer certificate if(arguments[0] instanceof Object)
{ if("issuerCertificate" in arguments[0]) // "issuerCertificate" must be of type "simpl.CERT"
{
subjectPublicKeyInfo = arguments[0].issuerCertificate.subjectPublicKeyInfo;
// The CRL issuer name and "issuerCertificate" subject name are not equal if(this.issuer.isEqual(arguments[0].issuerCertificate.subject) == false) returnnew Promise(function(resolve, reject) { resolve(false); });
}
// #region In case if there is only public key during verification if("publicKeyInfo" in arguments[0])
subjectPublicKeyInfo = arguments[0].publicKeyInfo; // Must be of type "org.pkijs.simpl.PUBLIC_KEY_INFO" // #endregion
}
if((subjectPublicKeyInfo instanceof in_window.org.pkijs.simpl.PUBLIC_KEY_INFO) === false) returnnew Promise(function(resolve, reject) { reject("Issuer's certificate must be provided as an input parameter"); }); // #endregion
// #region Check the CRL for unknown critical extensions if("crlExtensions" in this)
{ for(var i = 0; i < this.crlExtensions.length; i++)
{ if(this.crlExtensions[i].critical)
{ // We can not be sure that unknown extension has no value for CRL signature if(("parsedValue" in this.crlExtensions[i]) == false) returnnew Promise(function(resolve, reject) { resolve(false); });
}
}
} // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Import public key
sequence = sequence.then( function()
{ // #region Get information about public key algorithm and default parameters for import var algorithmObject = in_window.org.pkijs.getAlgorithmByOID(_this.signature.algorithm_id); if(("name" in algorithmObject) === "") returnnew Promise(function(resolve, reject) { reject("Unsupported public key algorithm: " + _this.signature.algorithm_id); });
var algorithm_name = algorithmObject.name;
var algorithm = in_window.org.pkijs.getAlgorithmParameters(algorithm_name, "importkey"); if("hash" in algorithm.algorithm)
algorithm.algorithm.hash.name = sha_algorithm; // #endregion
var publicKeyInfo_schema = subjectPublicKeyInfo.toSchema(); var publicKeyInfo_buffer = publicKeyInfo_schema.toBER(false); var publicKeyInfo_view = new Uint8Array(publicKeyInfo_buffer);
// #region Initial variables var _this = this; // #endregion
// #region Get a private key from function parameter if(typeof privateKey === "undefined") returnnew Promise(function(resolve, reject) { reject("Need to provide a private key for signing"); }); // #endregion
// #region Get a "default parameters" for current algorithm var defParams = in_window.org.pkijs.getAlgorithmParameters(privateKey.algorithm.name, "sign");
defParams.algorithm.hash.name = hashAlgorithm; // #endregion
// #region Fill internal structures base on "privateKey" and "hashAlgorithm" switch(privateKey.algorithm.name.toUpperCase())
{ case"RSASSA-PKCS1-V1_5": case"ECDSA":
_this.signature.algorithm_id = in_window.org.pkijs.getOIDByAlgorithm(defParams.algorithm);
_this.signatureAlgorithm.algorithm_id = _this.signature.algorithm_id; break; case"RSA-PSS":
{ // #region Set "saltLength" as a length (in octets) of hash function result switch(hashAlgorithm.toUpperCase())
{ case"SHA-256":
defParams.algorithm.saltLength = 32; break; case"SHA-384":
defParams.algorithm.saltLength = 48; break; case"SHA-512":
defParams.algorithm.saltLength = 64; break; default:
} // #endregion
// #region Fill "RSASSA_PSS_params" object var paramsObject = {};
paramsObject.hashAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({
algorithm_id: hashAlgorithmOID,
algorithm_params: new in_window.org.pkijs.asn1.NULL()
});
var pssParameters = new in_window.org.pkijs.simpl.x509.RSASSA_PSS_params(paramsObject); // #endregion
// #region Automatically set signature algorithm
_this.signature = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({
algorithm_id: "1.2.840.113549.1.1.10",
algorithm_params: pssParameters.toSchema()
});
_this.signatureAlgorithm = _this.signature; // Must be the same // #endregion
} break; default: returnnew Promise(function(resolve, reject) { reject("Unsupported signature algorithm: " + privateKey.algorithm.name); });
} // #endregion
// #region Create TBS data for signing
_this.tbs = in_window.org.pkijs.simpl.CRL.prototype.encodeTBS.call(this).toBER(false); // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Signing TBS data on provided private key return crypto.sign(
defParams.algorithm,
privateKey, new Uint8Array(_this.tbs)).
then( function(result)
{ // #region Special case for ECDSA algorithm if(defParams.algorithm.name === "ECDSA")
result = in_window.org.pkijs.createCMSECDSASignature(result); // #endregion
_this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING({ value_hex: result });
}, function(error)
{ returnnew Promise(function(resolve, reject) { reject("Signing error: " + error); });
}
); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CRL.prototype.isCertificateRevoked = function()
{ // #region Get input certificate var certificate = {};
// #region Check that issuer of the input certificate is the same with issuer of this CRL if(this.issuer.isEqual(certificate.issuer) === false) returnfalse; // #endregion
// #region Check that there are revoked certificates in this CRL if(("revokedCertificates" in this) === false) returnfalse; // #endregion
// #region Search for input certificate in revoked certificates array for(var i = 0; i < this.revokedCertificates.length; i++)
{ if(this.revokedCertificates[i].userCertificate.isEqual(certificate.serialNumber)) returntrue;
} // #endregion
if("version" in this)
_object.version = this.version;
if("nextUpdate" in this)
_object.nextUpdate = this.nextUpdate.toJSON();
if("revokedCertificates" in this)
{
_object.revokedCertificates = new Array();
for(var i = 0; i < this.revokedCertificates.length; i++)
_object.revokedCertificates.push(this.revokedCertificates[i].toJSON());
}
if("crlExtensions" in this)
{
_object.crlExtensions = new Array();
for(var i = 0; i < this.crlExtensions.length; i++)
_object.crlExtensions.push(this.crlExtensions[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for "Attribute" type //**************************************************************************************
in_window.org.pkijs.simpl.ATTRIBUTE = function()
{ // #region Internal properties of the object this.type = ""; this.values = new Array(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.ATTRIBUTE.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.type = arguments[0].type || ""; this.values = arguments[0].values || new Array();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.ATTRIBUTE.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.ATTRIBUTE({
names: {
type: "type",
values: "values"
}
})
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for ATTRIBUTE"); // #endregion
// #region Get internal properties from parsed schema this.type = asn1.result["type"].value_block.toString(); this.values = asn1.result["values"]; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.ATTRIBUTE.prototype.toSchema = function()
{ // #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [ new in_window.org.pkijs.asn1.OID({ value: this.type }), new in_window.org.pkijs.asn1.SET({
value: this.values
})
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.ATTRIBUTE.prototype.toJSON = function()
{ var _object = {
type: this.type,
values: new Array()
};
for(var i = 0; i < this.values.length; i++)
_object.values.push(this.values[i].toJSON());
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for PKCS#10 certificate request //**************************************************************************************
in_window.org.pkijs.simpl.PKCS10 = function()
{ // #region Internal properties of the object this.tbs = new ArrayBuffer(0);
this.version = 0; this.subject = new in_window.org.pkijs.simpl.RDN(); this.subjectPublicKeyInfo = new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO(); // OPTIONAL this.attributes = new Array(); // Array of simpl.ATTRIBUTE objects
this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate major part this.signatureValue = new in_window.org.pkijs.asn1.BITSTRING(); // #endregion
// #region If input argument array contains "schema" for this object if((arguments[0] instanceof Object) && ("schema" in arguments[0]))
in_window.org.pkijs.simpl.PKCS10.prototype.fromSchema.call(this, arguments[0].schema); // #endregion // #region If input argument array contains "native" values for internal properties else
{ if(arguments[0] instanceof Object)
{ this.tbs = arguments[0].tbs || new ArrayBuffer(0);
this.version = arguments[0].version || 0; this.subject = arguments[0].subject || new in_window.org.pkijs.simpl.RDN(); this.subjectPublicKeyInfo = arguments[0].subjectPublicKeyInfo || new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO();
if("attributes" in arguments[0]) this.attributes = arguments[0].attributes;
this.signatureAlgorithm = arguments[0].signatureAlgorithm || new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER(); // Signature algorithm from certificate major part this.signatureValue = arguments[0].signatureValue || new in_window.org.pkijs.asn1.BITSTRING();
}
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PKCS10.prototype.fromSchema = function(schema)
{ // #region Check the schema is valid var asn1 = in_window.org.pkijs.compareSchema(schema,
schema,
in_window.org.pkijs.schema.PKCS10()
);
if(asn1.verified === false) thrownew Error("Object's schema was not verified against input data for PKCS10"); // #endregion
// #region Get internal properties from parsed schema this.tbs = asn1.result["CertificationRequestInfo"].value_before_decode;
this.version = asn1.result["CertificationRequestInfo.version"].value_block.value_dec; this.subject = new in_window.org.pkijs.simpl.RDN({ schema: asn1.result["CertificationRequestInfo.subject"] }); this.subjectPublicKeyInfo = new in_window.org.pkijs.simpl.PUBLIC_KEY_INFO({ schema: asn1.result["CertificationRequestInfo.subjectPublicKeyInfo"] }); if("CertificationRequestInfo.attributes" in asn1.result)
{ this.attributes = new Array();
var attrs = asn1.result["CertificationRequestInfo.attributes"]; for(var i = 0; i < attrs.length; i++) this.attributes.push(new in_window.org.pkijs.simpl.ATTRIBUTE({ schema: attrs[i] }));
}
this.signatureAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({ schema: asn1.result["signatureAlgorithm"] }); this.signatureValue = asn1.result["signatureValue"]; // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PKCS10.prototype.encodeTBS = function()
{ // #region Create array for output sequence var output_array = new Array();
return (new in_window.org.pkijs.asn1.SEQUENCE({ value: output_array }));
}; //**************************************************************************************
in_window.org.pkijs.simpl.PKCS10.prototype.toSchema = function(encodeFlag)
{ /// <param name="encodeFlag" type="Boolean">If param equal to false then create TBS schema via decoding stored value. In othe case create TBS schema via assembling from TBS parts.</param>
// #region Decode stored TBS value var tbs_schema;
if(encodeFlag === false)
{ if(this.tbs.length === 0) // No stored TBS part return in_window.org.pkijs.schema.PKCS10();
tbs_schema = in_window.org.pkijs.fromBER(this.tbs).result;
} // #endregion // #region Create TBS schema via assembling from TBS parts else
tbs_schema = in_window.org.pkijs.simpl.PKCS10.prototype.encodeTBS.call(this); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: [
tbs_schema, this.signatureAlgorithm.toSchema(), this.signatureValue
]
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PKCS10.prototype.verify = function()
{ /// <summary>!!! Works well in Chrome dev versions only (April 2014th) !!!</summary> /// <returns type="Promise">Returns a new Promise object (in case of error), or a result of "crypto.subtle.veryfy" function</returns>
// #region Global variables var _this = this; var sha_algorithm = "";
var sequence = Promise.resolve();
var subjectPublicKeyInfo = this.subjectPublicKeyInfo; var signature = this.signatureValue; var tbs = this.tbs; // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Importing public key
sequence = sequence.then( function()
{ // #region Get information about public key algorithm and default parameters for import var algorithmObject = in_window.org.pkijs.getAlgorithmByOID(_this.signatureAlgorithm.algorithm_id); if(("name" in algorithmObject) === false) returnnew Promise(function(resolve, reject) { reject("Unsupported public key algorithm: " + _this.signatureAlgorithm.algorithm_id); });
var algorithm_name = algorithmObject.name;
var algorithm = in_window.org.pkijs.getAlgorithmParameters(algorithm_name, "importkey"); if("hash" in algorithm.algorithm)
algorithm.algorithm.hash.name = sha_algorithm; // #endregion
var publicKeyInfo_schema = subjectPublicKeyInfo.toSchema(); var publicKeyInfo_buffer = publicKeyInfo_schema.toBER(false); var publicKeyInfo_view = new Uint8Array(publicKeyInfo_buffer);
// #region Initial variables var _this = this; // #endregion
// #region Get a private key from function parameter if(typeof privateKey === "undefined") returnnew Promise(function(resolve, reject) { reject("Need to provide a private key for signing"); }); // #endregion
// #region Get a "default parameters" for current algorithm var defParams = in_window.org.pkijs.getAlgorithmParameters(privateKey.algorithm.name, "sign");
defParams.algorithm.hash.name = hashAlgorithm; // #endregion
// #region Fill internal structures base on "privateKey" and "hashAlgorithm" switch(privateKey.algorithm.name.toUpperCase())
{ case"RSASSA-PKCS1-V1_5": case"ECDSA":
_this.signatureAlgorithm.algorithm_id = in_window.org.pkijs.getOIDByAlgorithm(defParams.algorithm); break; case"RSA-PSS":
{ // #region Set "saltLength" as a length (in octets) of hash function result switch(hashAlgorithm.toUpperCase())
{ case"SHA-256":
defParams.algorithm.saltLength = 32; break; case"SHA-384":
defParams.algorithm.saltLength = 48; break; case"SHA-512":
defParams.algorithm.saltLength = 64; break; default:
} // #endregion
// #region Fill "RSASSA_PSS_params" object var paramsObject = {};
paramsObject.hashAlgorithm = new in_window.org.pkijs.simpl.ALGORITHM_IDENTIFIER({
algorithm_id: hashAlgorithmOID,
algorithm_params: new in_window.org.pkijs.asn1.NULL()
});
// #region Create TBS data for signing
_this.tbs = in_window.org.pkijs.simpl.PKCS10.prototype.encodeTBS.call(this).toBER(false); // #endregion
// #region Get a "crypto" extension var crypto = in_window.org.pkijs.getCrypto(); if(typeof crypto == "undefined") returnnew Promise(function(resolve, reject) { reject("Unable to create WebCrypto object"); }); // #endregion
// #region Signing TBS data on provided private key return crypto.sign(defParams.algorithm,
privateKey, new Uint8Array(_this.tbs)).then( function(result)
{ // #region Special case for ECDSA algorithm if(defParams.algorithm.name === "ECDSA")
result = in_window.org.pkijs.createCMSECDSASignature(result); // #endregion
// #region Construct and return new ASN.1 schema for this object return (new in_window.org.pkijs.asn1.SEQUENCE({
value: output_array
})); // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.PKCS8.prototype.toJSON = function()
{ var _object = {
version: this.version,
privateKeyAlgorithm: this.privateKeyAlgorithm.toJSON(),
privateKey: this.privateKey.toJSON()
};
if("attributes" in this)
{
_object.attributes = new Array();
for(var i = 0; i < this.attributes.length; i++)
_object.attributes.push(this.attributes[i].toJSON());
}
return _object;
}; //************************************************************************************** // #endregion //************************************************************************************** // #region Simplified structure for working with X.509 certificate chains //**************************************************************************************
in_window.org.pkijs.simpl.CERT_CHAIN = function()
{ // #region Internal properties of the object /// <field name="trusted_certs" type="Array" elementType="in_window.org.pkijs.simpl.CERT">Array of pre-defined trusted (by user) certificates</field> this.trusted_certs = new Array(); /// <field name="certs" type="Array" elementType="in_window.org.pkijs.simpl.CERT">Array with certificate chain. Could be only one end-user certificate in there!</field> this.certs = new Array(); /// <field name="crls" type="Array" elementType="in_window.org.pkijs.simpl.CRL">Array of all CRLs for all certificates from certificate chain</field> this.crls = new Array(); // #endregion
// #region Initialize internal properties by input values if(arguments[0] instanceof Object)
{ this.trusted_certs = arguments[0].trusted_certs || new Array(); this.certs = arguments[0].certs || new Array(); this.crls = arguments[0].crls || new Array();
} // #endregion
}; //**************************************************************************************
in_window.org.pkijs.simpl.CERT_CHAIN.prototype.sort = function()
{ // #region Initial variables /// <var type="Array" elementType="in_window.org.pkijs.simpl.CERT">Array of sorted certificates</var> var sorted_certs = new Array();
/// <var type="Array" elementType="in_window.org.pkijs.simpl.CERT">Initial array of certificates</var> var certs = this.certs.slice(0); // Explicity copy "this.certs"
/// <var type="Date">Date for checking certificate validity period</var> var check_date = new Date();
var _this = this; // #endregion
// #region Initial checks if(certs.length === 0) returnnew Promise(function(resolve, reject)
{
reject({
result: false,
result_code: 2,
result_message: "Certificate's array can not be empty"
});
}); // #endregion
// #region Find end-user certificate var end_user_index = -1;
for(var i = 0; i < certs.length; i++)
{ var isCA = false;
if("extensions" in certs[i])
{ var mustBeCA = false; var keyUsagePresent = false; var cRLSign = false;
// #region Check that subject certificate is not in the CRL
sequence = sequence.then( function(crl)
{ /// <param name="crl" type="in_window.org.pkijs.simpl.CRL">CRL for issuer's certificate</param>
if(crl.isCertificateRevoked({ certificate: subject_certificate }) === true) returnnew Promise(function(resolve, reject)
{
reject({
result: false,
result_code: 11,
result_message: "Subject certificate was revoked"
});
}); else returnnew Promise(function(resolve, reject) { resolve(); });
}, function(error)
{ /// <summary>Not for all certificates we have a CRL. So, this "stub" is for handling such situation - assiming we have a valid, non-revoked certificate</summary> returnnew Promise(function(resolve, reject) { resolve(); });
}
); // #endregion
if(current_certificate.issuer.isEqual(current_certificate.subject) === true)
{ // #region Check that the "self-signed" certificate there is in "trusted_certs" array var found = (_this.trusted_certs.length === 0); // If user did not set "trusted_certs" then we have an option to trust any self-signed certificate as root
for(var i = 0; i < _this.trusted_certs.length; i++)
{ if((current_certificate.issuer.isEqual(_this.trusted_certs[i].issuer) === true) &&
(current_certificate.subject.isEqual(_this.trusted_certs[i].subject) === true) &&
(current_certificate.serialNumber.isEqual(_this.trusted_certs[i].serialNumber) === true))
{
found = true; break;
}
}
// #region Initial variables var sequence = Promise.resolve();
var _this = this; // #endregion
// #region Get input variables var initial_policy_set = new Array();
initial_policy_set.push("2.5.29.32.0"); // "anyPolicy"
var initial_explicit_policy = false; var initial_policy_mapping_inhibit = false; var initial_inhibit_policy = false;
var initial_permitted_subtrees_set = new Array(); // Array of "simpl.x509.GeneralSubtree" var initial_excluded_subtrees_set = new Array(); // Array of "simpl.x509.GeneralSubtree" var initial_required_name_forms = new Array(); // Array of "simpl.x509.GeneralSubtree"
var verification_time = new Date();
if(arguments[0] instanceof Object)
{ if("initial_policy_set" in arguments[0])
initial_policy_set = arguments[0].initial_policy_set;
if("initial_explicit_policy" in arguments[0])
initial_explicit_policy = arguments[0].initial_explicit_policy;
if("initial_policy_mapping_inhibit" in arguments[0])
initial_policy_mapping_inhibit = arguments[0].initial_policy_mapping_inhibit;
if("initial_inhibit_policy" in arguments[0])
initial_inhibit_policy = arguments[0].initial_inhibit_policy;
if("initial_permitted_subtrees_set" in arguments[0])
initial_permitted_subtrees_set = arguments[0].initial_permitted_subtrees_set;
if("initial_excluded_subtrees_set" in arguments[0])
initial_excluded_subtrees_set = arguments[0].initial_excluded_subtrees_set;
if("initial_required_name_forms" in arguments[0])
initial_required_name_forms = arguments[0].initial_required_name_forms;
}
var explicit_policy_indicator = initial_explicit_policy; var policy_mapping_inhibit_indicator = initial_policy_mapping_inhibit; var inhibit_any_policy_indicator = initial_inhibit_policy;
var pending_constraints = new Array(3);
pending_constraints[0] = false; // For "explicit_policy_pending"
pending_constraints[1] = false; // For "policy_mapping_inhibit_pending"
pending_constraints[2] = false; // For "inhibit_any_policy_pending"
var explicit_policy_pending = 0; var policy_mapping_inhibit_pending = 0; var inhibit_any_policy_pending = 0;
var permitted_subtrees = initial_permitted_subtrees_set; var excluded_subtrees = initial_excluded_subtrees_set; var required_name_forms = initial_required_name_forms;
var path_depth = 1; // #endregion
// #region Sorting certificates in the chain array
sequence = (in_window.org.pkijs.simpl.CERT_CHAIN.prototype.sort.call(this)).then( function(sorted_certs)
{
_this.certs = sorted_certs;
}
); // #endregion
// #region Work with policies
sequence = sequence.then( function()
{ // #region Support variables var all_policies = new Array(); // Array of all policies (string values)
all_policies.push("2.5.29.32.0"); // Put "anyPolicy" at first place
var policies_and_certs = new Array(); // In fact "array of array" where rows are for each specific policy, column for each certificate and value is "true/false"
var any_policy_array = new Array(_this.certs.length - 1); // Minus "trusted anchor" for(var ii = 0; ii < (_this.certs.length - 1) ; ii++)
any_policy_array[ii] = true;
policies_and_certs.push(any_policy_array);
var policy_mappings = new Array(_this.certs.length - 1); // Array of "PolicyMappings" for each certificate var cert_policies = new Array(_this.certs.length - 1); // Array of "CertificatePolicies" for each certificate // #endregion
// #region Check "inhibit_any_policy_indicator" if(inhibit_any_policy_indicator === true) delete (policies_and_certs[0])[i]; // Unset value to "undefined" for "anyPolicies" value for current certificate // #endregion
// #region Combine information from certificate policies and policy mappings if((typeof cert_policies[i] !== "undefined") &&
(typeof policy_mappings[i] !== "undefined") &&
(policy_mapping_inhibit_indicator === false))
{ for(var m = 0; m < cert_policies[i].certificatePolicies.length; m++)
{ var domainPolicy = "";
// #region Find if current policy is in "mappings" array for(var n = 0; n < policy_mappings[i].mappings.length; n++)
{ if(policy_mappings[i].mappings[n].subjectDomainPolicy === cert_policies[i].certificatePolicies[m].policyIdentifier)
{
domainPolicy = policy_mappings[i].mappings[n].issuerDomainPolicy; break;
}
// #region Could be the case for some reasons if(policy_mappings[i].mappings[n].issuerDomainPolicy === cert_policies[i].certificatePolicies[m].policyIdentifier)
{
domainPolicy = policy_mappings[i].mappings[n].subjectDomainPolicy; break;
} // #endregion
}
if(domainPolicy === "") continue; // #endregion
// #region Find the index of "domainPolicy" var domainPolicy_index = (-1);
// #region Change array value for "domainPolicy" if(domainPolicy_index !== (-1))
(policies_and_certs[domainPolicy_index])[i] = true; // Put "set" in "domainPolicy" cell for specific certificate // #endregion
}
} // #endregion
// #region Work with name constraints
sequence = sequence.then( function(policy_result)
{ // #region Auxiliary functions for name constraints checking function compare_dNSName(name, constraint)
{ /// <summary>Compare two dNSName values</summary> /// <param name="name" type="String">DNS from name</param> /// <param name="constraint" type="String">Constraint for DNS from name</param> /// <returns type="Boolean">Boolean result - valid or invalid the "name" against the "constraint"</returns>
// #region Make a "string preparation" for both name and constrain var name_prepared = in_window.org.pkijs.stringPrep(name); var constraint_prepared = in_window.org.pkijs.stringPrep(constraint); // #endregion
// #region Make a "splitted" versions of "constraint" and "name" var name_splitted = name_prepared.split("."); var constraint_splitted = constraint_prepared.split("."); // #endregion
// #region Length calculation and additional check var name_len = name_splitted.length; var constr_len = constraint_splitted.length;
// #region Check that no part of "name" has zero length for(var i = 0; i < name_len; i++)
{ if(name_splitted[i].length === 0) returnfalse;
} // #endregion
// #region Check that no part of "constraint" has zero length for(var i = 0; i < constr_len; i++)
{ if(constraint_splitted[i].length === 0)
{ if(i === 0)
{ if(constr_len === 1) returnfalse; else continue;
}
returnfalse;
}
} // #endregion
// #region Check that "name" has a tail as "constraint"
for(var i = 0; i < constr_len; i++)
{ if(constraint_splitted[constr_len - 1 - i].length === 0) continue;
function compare_rfc822Name(name, constraint)
{ /// <summary>Compare two rfc822Name values</summary> /// <param name="name" type="String">E-mail address from name</param> /// <param name="constraint" type="String">Constraint for e-mail address from name</param> /// <returns type="Boolean">Boolean result - valid or invalid the "name" against the "constraint"</returns>
// #region Make a "string preparation" for both name and constrain var name_prepared = in_window.org.pkijs.stringPrep(name); var constraint_prepared = in_window.org.pkijs.stringPrep(constraint); // #endregion
// #region Make a "splitted" versions of "constraint" and "name" var name_splitted = name_prepared.split("@"); var constraint_splitted = constraint_prepared.split("@"); // #endregion
if(constraint_splitted.length === 1)
{ var result = compare_dNSName(name_splitted[1], constraint_splitted[0]);
if(result)
{ // #region Make a "splitted" versions of domain name from "constraint" and "name" var ns = name_splitted[1].split("."); var cs = constraint_splitted[0].split("."); // #endregion
function compare_uniformResourceIdentifier(name, constraint)
{ /// <summary>Compare two uniformResourceIdentifier values</summary> /// <param name="name" type="String">uniformResourceIdentifier from name</param> /// <param name="constraint" type="String">Constraint for uniformResourceIdentifier from name</param> /// <returns type="Boolean">Boolean result - valid or invalid the "name" against the "constraint"</returns>
// #region Make a "string preparation" for both name and constrain var name_prepared = in_window.org.pkijs.stringPrep(name); var constraint_prepared = in_window.org.pkijs.stringPrep(constraint); // #endregion
// #region Find out a major URI part to compare with var ns = name_prepared.split("/"); var cs = constraint_prepared.split("/");
if(ns.length > 1) // Full URI string
{ for(var i = 0; i < ns.length; i++)
{ if((ns[i].length > 0) && (ns[i].charAt(ns[i].length - 1) !== ':'))
{ var ns_port = ns[i].split(":");
name_prepared = ns_port[0]; break;
}
}
} // #endregion
var result = compare_dNSName(name_prepared, constraint_prepared);
if(result)
{ // #region Make a "splitted" versions of "constraint" and "name" var name_splitted = name_prepared.split("."); var constraint_splitted = constraint_prepared.split("."); // #endregion
function compare_iPAddress(name, constraint)
{ /// <summary>Compare two iPAddress values</summary> /// <param name="name" type="in_window.org.pkijs.asn1.OCTETSTRING">iPAddress from name</param> /// <param name="constraint" type="in_window.org.pkijs.asn1.OCTETSTRING">Constraint for iPAddress from name</param> /// <returns type="Boolean">Boolean result - valid or invalid the "name" against the "constraint"</returns>
// #region Common variables var name_view = new Uint8Array(name.value_block.value_hex); var constraint_view = new Uint8Array(constraint.value_block.value_hex); // #endregion
// #region Work with IPv4 addresses if((name_view.length === 4) && (constraint_view.length === 8))
{ for(var i = 0; i < 4; i++)
{ if((name_view[i] ^ constraint_view[i]) & constraint_view[i + 4]) returnfalse;
}
returntrue;
} // #endregion
// #region Work with IPv6 addresses if((name_view.length === 16) && (constraint_view.length === 32))
{ for(var i = 0; i < 16; i++)
{ if((name_view[i] ^ constraint_view[i]) & constraint_view[i + 16]) returnfalse;
}
returntrue;
} // #endregion
returnfalse;
}
function compare_directoryName(name, constraint)
{ /// <summary>Compare two directoryName values</summary> /// <param name="name" type="in_window.org.pkijs.simpl.RDN">directoryName from name</param> /// <param name="constraint" type="in_window.org.pkijs.simpl.RDN">Constraint for directoryName from name</param> /// <param name="any" type="Boolean">Boolean flag - should be comparision interrupted after first match or we need to match all "constraints" parts</param> /// <returns type="Boolean">Boolean result - valid or invalid the "name" against the "constraint"</returns>
// #region Checking for "permited sub-trees" // #region Make groups for all types of constraints var constr_groups = new Array(); // Array of array for groupped constraints
constr_groups[0] = new Array(); // rfc822Name
constr_groups[1] = new Array(); // dNSName
constr_groups[2] = new Array(); // directoryName
constr_groups[3] = new Array(); // uniformResourceIdentifier
constr_groups[4] = new Array(); // iPAddress
// #region Check name constraints groupped by type, one-by-one for(var p = 0; p < 5; p++)
{ var group_permitted = false; var valueExists = false; var group = constr_groups[p];
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.285Bemerkung:
(vorverarbeitet am 2026-04-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.