Comparing version 2.1.44 to 2.1.45
@@ -52,3 +52,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -86,3 +85,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -105,3 +103,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -123,3 +120,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -139,3 +135,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -160,3 +155,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -163,0 +157,0 @@ /** |
@@ -134,2 +134,3 @@ "use strict"; | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
if (this.value instanceof asn1js.Utf8String && compareTo.value instanceof asn1js.Utf8String || this.value instanceof asn1js.BmpString && compareTo.value instanceof asn1js.BmpString || this.value instanceof asn1js.UniversalString && compareTo.value instanceof asn1js.UniversalString || this.value instanceof asn1js.NumericString && compareTo.value instanceof asn1js.NumericString || this.value instanceof asn1js.PrintableString && compareTo.value instanceof asn1js.PrintableString || this.value instanceof asn1js.TeletexString && compareTo.value instanceof asn1js.TeletexString || this.value instanceof asn1js.VideotexString && compareTo.value instanceof asn1js.VideotexString || this.value instanceof asn1js.IA5String && compareTo.value instanceof asn1js.IA5String || this.value instanceof asn1js.GraphicString && compareTo.value instanceof asn1js.GraphicString || this.value instanceof asn1js.VisibleString && compareTo.value instanceof asn1js.VisibleString || this.value instanceof asn1js.GeneralString && compareTo.value instanceof asn1js.GeneralString || this.value instanceof asn1js.CharacterString && compareTo.value instanceof asn1js.CharacterString) { | ||
@@ -136,0 +137,0 @@ var value1 = (0, _common.stringPrep)(this.value.valueBlock.value); |
@@ -251,2 +251,3 @@ "use strict"; | ||
// noinspection JSUnresolvedVariable | ||
var recipientKey = parameters.safeContents[index].recipientKey; | ||
@@ -263,3 +264,7 @@ //endregion | ||
sequence = sequence.then(function (result) { | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
var asn1 = asn1js.fromBER(result); | ||
@@ -309,3 +314,7 @@ if (asn1.offset === -1) return Promise.reject("Error during parsing of decrypted data"); | ||
//region Initialize internal data | ||
sequence = sequence.then(function (result) { | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
var asn1 = asn1js.fromBER(result); | ||
@@ -312,0 +321,0 @@ if (asn1.offset === -1) return Promise.reject("Error during parsing of decrypted data"); |
@@ -663,2 +663,3 @@ "use strict"; | ||
{ | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
var comparisonResult = _ResponseData2.default.compareWithDefault("tbs", memberValue.tbs) && _ResponseData2.default.compareWithDefault("responderID", memberValue.responderID) && _ResponseData2.default.compareWithDefault("producedAt", memberValue.producedAt) && _ResponseData2.default.compareWithDefault("responses", memberValue.responses); | ||
@@ -665,0 +666,0 @@ |
@@ -70,3 +70,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -82,3 +81,2 @@ /** | ||
//********************************************************************************** | ||
@@ -110,3 +108,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -127,3 +124,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -145,3 +141,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -175,3 +170,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -245,3 +239,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -264,3 +257,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -287,3 +279,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -290,0 +281,0 @@ /** |
@@ -229,2 +229,3 @@ "use strict"; | ||
//region Get internal properties from parsed schema | ||
// noinspection JSUnresolvedVariable | ||
this.tbs = asn1.result.tbsCertList.valueBeforeDecode; | ||
@@ -231,0 +232,0 @@ |
@@ -58,3 +58,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -96,3 +95,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -113,3 +111,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -129,3 +126,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -145,3 +141,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -166,3 +161,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -169,0 +163,0 @@ /** |
@@ -152,3 +152,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -164,3 +163,2 @@ /** | ||
//********************************************************************************** | ||
@@ -210,3 +208,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -265,3 +262,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -293,3 +289,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -457,3 +452,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -613,3 +607,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -801,3 +794,7 @@ /** | ||
//region Apply KDF function to shared secret | ||
currentSequence = currentSequence.then(function (result) { | ||
currentSequence = currentSequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
//region Get length of used AES-KW algorithm | ||
@@ -1114,3 +1111,2 @@ var aesKWAlgorithm = new _AlgorithmIdentifier2.default({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
} | ||
//********************************************************************************** | ||
@@ -1227,3 +1223,7 @@ /** | ||
//region Apply KDF function to shared secret | ||
currentSequence = currentSequence.then(function (result) { | ||
currentSequence = currentSequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
//region Get length of used AES-KW algorithm | ||
@@ -1554,3 +1554,2 @@ var aesKWAlgorithm = new _AlgorithmIdentifier2.default({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
} | ||
//********************************************************************************** | ||
@@ -1576,3 +1575,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -1602,3 +1600,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -1605,0 +1602,0 @@ /** |
@@ -180,2 +180,3 @@ "use strict"; | ||
case "date": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return memberValue.year === 0 && memberValue.month === 0 && memberValue.day === 0 && memberValue.hour === 0 && memberValue.minute === 0 && memberValue.second === 0 && memberValue.millisecond === 0; | ||
@@ -182,0 +183,0 @@ case "other": |
@@ -65,3 +65,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -106,3 +105,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -127,3 +125,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -147,3 +144,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -165,3 +161,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -188,3 +183,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -191,0 +185,0 @@ /** |
@@ -74,3 +74,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -268,3 +267,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -282,2 +280,3 @@ /** | ||
case "tbsRequest": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return _TBSRequest2.default.compareWithDefault("tbs", memberValue.tbs) && _TBSRequest2.default.compareWithDefault("version", memberValue.version) && _TBSRequest2.default.compareWithDefault("requestorName", memberValue.requestorName) && _TBSRequest2.default.compareWithDefault("requestList", memberValue.requestList) && _TBSRequest2.default.compareWithDefault("requestExtensions", memberValue.requestExtensions); | ||
@@ -284,0 +283,0 @@ case "optionalSignature": |
@@ -77,3 +77,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -89,3 +88,2 @@ /** | ||
//********************************************************************************** | ||
@@ -117,3 +115,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -134,3 +131,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -177,3 +173,7 @@ /** | ||
//region Initialize "parsedValue" with decrypted PKCS#8 private key | ||
sequence = sequence.then(function (result) { | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
var asn1 = asn1js.fromBER(result); | ||
@@ -192,3 +192,2 @@ if (asn1.offset === -1) return Promise.reject("Error during parsing ASN.1 data"); | ||
} | ||
//********************************************************************************** | ||
@@ -230,3 +229,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -248,3 +246,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -271,3 +268,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -274,0 +270,0 @@ /** |
@@ -78,3 +78,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -90,3 +89,2 @@ /** | ||
//********************************************************************************** | ||
@@ -146,3 +144,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -163,3 +160,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -228,3 +224,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -264,3 +259,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -292,3 +286,7 @@ | ||
//region Initialize internal variables by parsing exported value | ||
sequence = sequence.then(function (exportedKey) { | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} exportedKey | ||
*/ | ||
function (exportedKey) { | ||
var asn1 = asn1js.fromBER(exportedKey); | ||
@@ -309,3 +307,2 @@ try { | ||
} | ||
//********************************************************************************** | ||
@@ -325,3 +322,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -328,0 +324,0 @@ /** |
@@ -181,2 +181,3 @@ "use strict"; | ||
case "date": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return memberValue.year === 0 && memberValue.month === 0 && memberValue.day === 0 && memberValue.hour === 0 && memberValue.minute === 0 && memberValue.second === 0 && memberValue.millisecond === 0; | ||
@@ -183,0 +184,0 @@ case "other": |
@@ -64,3 +64,2 @@ "use strict"; | ||
} | ||
//********************************************************************************** | ||
@@ -76,3 +75,2 @@ /** | ||
//********************************************************************************** | ||
@@ -122,3 +120,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -156,3 +153,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -176,3 +172,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -192,3 +187,2 @@ | ||
} | ||
//********************************************************************************** | ||
@@ -195,0 +189,0 @@ /** |
@@ -877,3 +877,7 @@ "use strict"; | ||
return true; | ||
}).then(function (result) { | ||
}).then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
function (result) { | ||
//region Verify result of previous operation | ||
@@ -880,0 +884,0 @@ if (result === false) return false; |
@@ -220,2 +220,3 @@ "use strict"; | ||
case "certID": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return _CertID2.default.compareWithDefault("hashAlgorithm", memberValue.hashAlgorithm) && _CertID2.default.compareWithDefault("issuerNameHash", memberValue.issuerNameHash) && _CertID2.default.compareWithDefault("issuerKeyHash", memberValue.issuerKeyHash) && _CertID2.default.compareWithDefault("serialNumber", memberValue.serialNumber); | ||
@@ -222,0 +223,0 @@ case "certStatus": |
@@ -295,2 +295,3 @@ "use strict"; | ||
//region Calculate message digest for input "data" buffer | ||
// noinspection JSCheckFunctionSignatures | ||
sequence = sequence.then(function () { | ||
@@ -297,0 +298,0 @@ return crypto.digest(shaAlgorithm.name, new Uint8Array(data)); |
@@ -85,4 +85,4 @@ { | ||
"name": "pkijs", | ||
"version": "2.1.44", | ||
"version": "2.1.45", | ||
"license": "MIT" | ||
} |
@@ -34,3 +34,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -53,3 +52,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -73,3 +71,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -140,3 +137,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -160,3 +156,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -174,5 +169,4 @@ /** | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -162,2 +162,3 @@ import * as asn1js from "asn1js"; | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
if(((this.value instanceof asn1js.Utf8String) && (compareTo.value instanceof asn1js.Utf8String)) || | ||
@@ -164,0 +165,0 @@ ((this.value instanceof asn1js.BmpString) && (compareTo.value instanceof asn1js.BmpString)) || |
@@ -236,2 +236,3 @@ import * as asn1js from "asn1js"; | ||
// noinspection JSUnresolvedVariable | ||
const recipientKey = parameters.safeContents[index].recipientKey; | ||
@@ -249,2 +250,5 @@ //endregion | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
@@ -293,2 +297,5 @@ { | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
@@ -295,0 +302,0 @@ { |
@@ -91,2 +91,3 @@ import * as asn1js from "asn1js"; | ||
{ | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
let comparisonResult = ((ResponseData.compareWithDefault("tbs", memberValue.tbs)) && | ||
@@ -93,0 +94,0 @@ (ResponseData.compareWithDefault("responderID", memberValue.responderID)) && |
@@ -47,3 +47,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -69,3 +68,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -91,3 +89,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -132,3 +129,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -165,3 +161,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -185,3 +180,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -201,3 +195,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -233,3 +226,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -307,5 +299,4 @@ /** | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -53,3 +53,3 @@ import { getParametersValue, isEqualBuffer } from "pvutils"; | ||
//********************************************************************************** | ||
defaultFindOrigin(certificate, validationEngine) | ||
static defaultFindOrigin(certificate, validationEngine) | ||
{ | ||
@@ -242,3 +242,3 @@ //region Firstly encode TBS for certificate | ||
case "findOrigin": | ||
return this.defaultFindOrigin; | ||
return CertificateChainValidationEngine.defaultFindOrigin; | ||
case "findIssuer": | ||
@@ -495,2 +495,3 @@ return this.defaultFindIssuer; | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
if((isCA === true) && (keyUsagePresent === true) && ((needToCheckCRL) && (cRLSign === false))) | ||
@@ -497,0 +498,0 @@ { |
@@ -267,2 +267,3 @@ import * as asn1js from "asn1js"; | ||
//region Get internal properties from parsed schema | ||
// noinspection JSUnresolvedVariable | ||
this.tbs = asn1.result.tbsCertList.valueBeforeDecode; | ||
@@ -269,0 +270,0 @@ |
@@ -219,42 +219,8 @@ import * as asn1js from "asn1js"; | ||
case (rValue.valueBlock.valueHex.byteLength < sValue.valueBlock.valueHex.byteLength): | ||
{ | ||
if((sValue.valueBlock.valueHex.byteLength - rValue.valueBlock.valueHex.byteLength) !== 1) | ||
throw new Error("Incorrect DER integer decoding"); | ||
const correctedLength = sValue.valueBlock.valueHex.byteLength; | ||
const rValueView = new Uint8Array(rValue.valueBlock.valueHex); | ||
const rValueBufferCorrected = new ArrayBuffer(correctedLength); | ||
const rValueViewCorrected = new Uint8Array(rValueBufferCorrected); | ||
rValueViewCorrected.set(rValueView, 1); | ||
rValueViewCorrected[0] = 0x00; // In order to be sure we do not have any garbage here | ||
return utilConcatBuf(rValueBufferCorrected, sValue.valueBlock.valueHex); | ||
} | ||
case (rValue.valueBlock.valueHex.byteLength > sValue.valueBlock.valueHex.byteLength): | ||
{ | ||
if((rValue.valueBlock.valueHex.byteLength - sValue.valueBlock.valueHex.byteLength) !== 1) | ||
throw new Error("Incorrect DER integer decoding"); | ||
const correctedLength = rValue.valueBlock.valueHex.byteLength; | ||
const sValueView = new Uint8Array(sValue.valueBlock.valueHex); | ||
const sValueBufferCorrected = new ArrayBuffer(correctedLength); | ||
const sValueViewCorrected = new Uint8Array(sValueBufferCorrected); | ||
sValueViewCorrected.set(sValueView, 1); | ||
sValueViewCorrected[0] = 0x00; // In order to be sure we do not have any garbage here | ||
return utilConcatBuf(rValue.valueBlock.valueHex, sValueBufferCorrected); | ||
} | ||
default: | ||
{ | ||
//region In case we have equal length and the length is not even with 2 | ||
if(rValue.valueBlock.valueHex.byteLength % 2) | ||
{ | ||
const correctedLength = (rValue.valueBlock.valueHex.byteLength + 1); | ||
if((sValue.valueBlock.valueHex.byteLength - rValue.valueBlock.valueHex.byteLength) !== 1) | ||
throw new Error("Incorrect DER integer decoding"); | ||
const correctedLength = sValue.valueBlock.valueHex.byteLength; | ||
const rValueView = new Uint8Array(rValue.valueBlock.valueHex); | ||
@@ -268,2 +234,11 @@ | ||
return utilConcatBuf(rValueBufferCorrected, sValue.valueBlock.valueHex); | ||
} | ||
case (rValue.valueBlock.valueHex.byteLength > sValue.valueBlock.valueHex.byteLength): | ||
{ | ||
if((rValue.valueBlock.valueHex.byteLength - sValue.valueBlock.valueHex.byteLength) !== 1) | ||
throw new Error("Incorrect DER integer decoding"); | ||
const correctedLength = rValue.valueBlock.valueHex.byteLength; | ||
const sValueView = new Uint8Array(sValue.valueBlock.valueHex); | ||
@@ -277,6 +252,31 @@ | ||
return utilConcatBuf(rValueBufferCorrected, sValueBufferCorrected); | ||
return utilConcatBuf(rValue.valueBlock.valueHex, sValueBufferCorrected); | ||
} | ||
//endregion | ||
} | ||
default: | ||
{ | ||
//region In case we have equal length and the length is not even with 2 | ||
if(rValue.valueBlock.valueHex.byteLength % 2) | ||
{ | ||
const correctedLength = (rValue.valueBlock.valueHex.byteLength + 1); | ||
const rValueView = new Uint8Array(rValue.valueBlock.valueHex); | ||
const rValueBufferCorrected = new ArrayBuffer(correctedLength); | ||
const rValueViewCorrected = new Uint8Array(rValueBufferCorrected); | ||
rValueViewCorrected.set(rValueView, 1); | ||
rValueViewCorrected[0] = 0x00; // In order to be sure we do not have any garbage here | ||
const sValueView = new Uint8Array(sValue.valueBlock.valueHex); | ||
const sValueBufferCorrected = new ArrayBuffer(correctedLength); | ||
const sValueViewCorrected = new Uint8Array(sValueBufferCorrected); | ||
sValueViewCorrected.set(sValueView, 1); | ||
sValueViewCorrected[0] = 0x00; // In order to be sure we do not have any garbage here | ||
return utilConcatBuf(rValueBufferCorrected, sValueBufferCorrected); | ||
} | ||
//endregion | ||
} | ||
} | ||
@@ -283,0 +283,0 @@ //endregion |
@@ -36,3 +36,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -55,3 +54,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -76,3 +74,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -144,3 +141,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -162,3 +158,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -176,5 +171,4 @@ /** | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -75,3 +75,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -100,3 +99,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -127,3 +125,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -193,3 +190,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -242,3 +238,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -293,3 +288,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -317,3 +311,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -489,3 +482,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -653,3 +645,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -847,52 +838,57 @@ /** | ||
//region Apply KDF function to shared secret | ||
currentSequence = currentSequence.then(result => | ||
{ | ||
//region Get length of used AES-KW algorithm | ||
const aesKWAlgorithm = new AlgorithmIdentifier({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
const KWalgorithm = getAlgorithmByOID(aesKWAlgorithm.algorithmId); | ||
if(("name" in KWalgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${aesKWAlgorithm.algorithmId}`); | ||
//endregion | ||
//region Translate AES-KW length to ArrayBuffer | ||
let kwLength = KWalgorithm.length; | ||
const kwLengthBuffer = new ArrayBuffer(4); | ||
const kwLengthView = new Uint8Array(kwLengthBuffer); | ||
for(let j = 3; j >= 0; j--) | ||
currentSequence = currentSequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
{ | ||
kwLengthView[j] = kwLength; | ||
kwLength >>= 8; | ||
} | ||
//endregion | ||
//region Create and encode "ECC-CMS-SharedInfo" structure | ||
const eccInfo = new ECCCMSSharedInfo({ | ||
keyInfo: new AlgorithmIdentifier({ | ||
algorithmId: aesKWAlgorithm.algorithmId, | ||
/* | ||
Initially RFC5753 says that AES algorithms have absent parameters. | ||
But since early implementations all put NULL here. Thus, in order to be | ||
"backward compatible", index also put NULL here. | ||
*/ | ||
algorithmParams: new asn1js.Null() | ||
}), | ||
entityUInfo: _this.recipientInfos[index].value.ukm, | ||
suppPubInfo: new asn1js.OctetString({ valueHex: kwLengthBuffer }) | ||
}); | ||
const encodedInfo = eccInfo.toSchema().toBER(false); | ||
//endregion | ||
//region Get SHA algorithm used together with ECDH | ||
const ecdhAlgorithm = getAlgorithmByOID(_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId); | ||
if(("name" in ecdhAlgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId}`); | ||
//endregion | ||
return kdf(ecdhAlgorithm.kdf, result, KWalgorithm.length, encodedInfo); | ||
}, error => | ||
Promise.reject(error)); | ||
//region Get length of used AES-KW algorithm | ||
const aesKWAlgorithm = new AlgorithmIdentifier({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
const KWalgorithm = getAlgorithmByOID(aesKWAlgorithm.algorithmId); | ||
if(("name" in KWalgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${aesKWAlgorithm.algorithmId}`); | ||
//endregion | ||
//region Translate AES-KW length to ArrayBuffer | ||
let kwLength = KWalgorithm.length; | ||
const kwLengthBuffer = new ArrayBuffer(4); | ||
const kwLengthView = new Uint8Array(kwLengthBuffer); | ||
for(let j = 3; j >= 0; j--) | ||
{ | ||
kwLengthView[j] = kwLength; | ||
kwLength >>= 8; | ||
} | ||
//endregion | ||
//region Create and encode "ECC-CMS-SharedInfo" structure | ||
const eccInfo = new ECCCMSSharedInfo({ | ||
keyInfo: new AlgorithmIdentifier({ | ||
algorithmId: aesKWAlgorithm.algorithmId, | ||
/* | ||
Initially RFC5753 says that AES algorithms have absent parameters. | ||
But since early implementations all put NULL here. Thus, in order to be | ||
"backward compatible", index also put NULL here. | ||
*/ | ||
algorithmParams: new asn1js.Null() | ||
}), | ||
entityUInfo: _this.recipientInfos[index].value.ukm, | ||
suppPubInfo: new asn1js.OctetString({ valueHex: kwLengthBuffer }) | ||
}); | ||
const encodedInfo = eccInfo.toSchema().toBER(false); | ||
//endregion | ||
//region Get SHA algorithm used together with ECDH | ||
const ecdhAlgorithm = getAlgorithmByOID(_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId); | ||
if(("name" in ecdhAlgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId}`); | ||
//endregion | ||
return kdf(ecdhAlgorithm.kdf, result, KWalgorithm.length, encodedInfo); | ||
}, | ||
error => | ||
Promise.reject(error)); | ||
//endregion | ||
@@ -1195,3 +1191,2 @@ //region Import AES-KW key from result of KDF function | ||
} | ||
//********************************************************************************** | ||
@@ -1325,52 +1320,57 @@ /** | ||
//region Apply KDF function to shared secret | ||
currentSequence = currentSequence.then(result => | ||
{ | ||
//region Get length of used AES-KW algorithm | ||
const aesKWAlgorithm = new AlgorithmIdentifier({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
currentSequence = currentSequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
{ | ||
//region Get length of used AES-KW algorithm | ||
const aesKWAlgorithm = new AlgorithmIdentifier({ schema: _this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmParams }); | ||
const KWalgorithm = getAlgorithmByOID(aesKWAlgorithm.algorithmId); | ||
if(("name" in KWalgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${aesKWAlgorithm.algorithmId}`); | ||
//endregion | ||
const KWalgorithm = getAlgorithmByOID(aesKWAlgorithm.algorithmId); | ||
if(("name" in KWalgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${aesKWAlgorithm.algorithmId}`); | ||
//endregion | ||
//region Translate AES-KW length to ArrayBuffer | ||
let kwLength = KWalgorithm.length; | ||
//region Translate AES-KW length to ArrayBuffer | ||
let kwLength = KWalgorithm.length; | ||
const kwLengthBuffer = new ArrayBuffer(4); | ||
const kwLengthView = new Uint8Array(kwLengthBuffer); | ||
const kwLengthBuffer = new ArrayBuffer(4); | ||
const kwLengthView = new Uint8Array(kwLengthBuffer); | ||
for(let j = 3; j >= 0; j--) | ||
{ | ||
kwLengthView[j] = kwLength; | ||
kwLength >>= 8; | ||
} | ||
//endregion | ||
for(let j = 3; j >= 0; j--) | ||
{ | ||
kwLengthView[j] = kwLength; | ||
kwLength >>= 8; | ||
} | ||
//endregion | ||
//region Create and encode "ECC-CMS-SharedInfo" structure | ||
const eccInfo = new ECCCMSSharedInfo({ | ||
keyInfo: new AlgorithmIdentifier({ | ||
algorithmId: aesKWAlgorithm.algorithmId, | ||
/* | ||
Initially RFC5753 says that AES algorithms have absent parameters. | ||
But since early implementations all put NULL here. Thus, in order to be | ||
"backward compatible", index also put NULL here. | ||
*/ | ||
algorithmParams: new asn1js.Null() | ||
}), | ||
entityUInfo: _this.recipientInfos[index].value.ukm, | ||
suppPubInfo: new asn1js.OctetString({ valueHex: kwLengthBuffer }) | ||
}); | ||
//region Create and encode "ECC-CMS-SharedInfo" structure | ||
const eccInfo = new ECCCMSSharedInfo({ | ||
keyInfo: new AlgorithmIdentifier({ | ||
algorithmId: aesKWAlgorithm.algorithmId, | ||
/* | ||
Initially RFC5753 says that AES algorithms have absent parameters. | ||
But since early implementations all put NULL here. Thus, in order to be | ||
"backward compatible", index also put NULL here. | ||
*/ | ||
algorithmParams: new asn1js.Null() | ||
}), | ||
entityUInfo: _this.recipientInfos[index].value.ukm, | ||
suppPubInfo: new asn1js.OctetString({ valueHex: kwLengthBuffer }) | ||
}); | ||
const encodedInfo = eccInfo.toSchema().toBER(false); | ||
//endregion | ||
//region Get SHA algorithm used together with ECDH | ||
const ecdhAlgorithm = getAlgorithmByOID(_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId); | ||
if(("name" in ecdhAlgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId}`); | ||
const encodedInfo = eccInfo.toSchema().toBER(false); | ||
//endregion | ||
return kdf(ecdhAlgorithm.kdf, result, KWalgorithm.length, encodedInfo); | ||
}, error => | ||
Promise.reject(error) | ||
//region Get SHA algorithm used together with ECDH | ||
const ecdhAlgorithm = getAlgorithmByOID(_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId); | ||
if(("name" in ecdhAlgorithm) === false) | ||
return Promise.reject(`Incorrect OID for key encryption algorithm: ${_this.recipientInfos[index].value.keyEncryptionAlgorithm.algorithmId}`); | ||
//endregion | ||
return kdf(ecdhAlgorithm.kdf, result, KWalgorithm.length, encodedInfo); | ||
}, | ||
error => | ||
Promise.reject(error) | ||
); | ||
@@ -1711,5 +1711,4 @@ //endregion | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -76,2 +76,3 @@ import * as asn1js from "asn1js"; | ||
case "date": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return ((memberValue.year === 0) && | ||
@@ -78,0 +79,0 @@ (memberValue.month === 0) && |
@@ -43,3 +43,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -64,3 +63,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -87,3 +85,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -167,3 +164,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -190,3 +186,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -209,5 +204,4 @@ /** | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -42,3 +42,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -61,3 +60,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -74,2 +72,3 @@ /** | ||
case "tbsRequest": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return ((TBSRequest.compareWithDefault("tbs", memberValue.tbs)) && | ||
@@ -76,0 +75,0 @@ (TBSRequest.compareWithDefault("version", memberValue.version)) && |
@@ -46,3 +46,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -67,3 +66,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -90,3 +88,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -139,3 +136,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -172,3 +168,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -190,3 +185,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -227,2 +221,5 @@ /** | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
@@ -244,3 +241,2 @@ { | ||
} | ||
//********************************************************************************** | ||
@@ -284,5 +280,4 @@ makeInternalValues(parameters) | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -50,3 +50,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -69,3 +68,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -99,3 +97,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -166,3 +163,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -184,3 +180,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -225,3 +220,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -261,3 +255,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -288,16 +281,21 @@ importKey(publicKey) | ||
//region Initialize internal variables by parsing exported value | ||
sequence = sequence.then(exportedKey => | ||
{ | ||
const asn1 = asn1js.fromBER(exportedKey); | ||
try | ||
sequence = sequence.then( | ||
/** | ||
* @param {ArrayBuffer} exportedKey | ||
*/ | ||
exportedKey => | ||
{ | ||
_this.fromSchema(asn1.result); | ||
} | ||
catch(exception) | ||
{ | ||
return Promise.reject("Error during initializing object from schema"); | ||
} | ||
const asn1 = asn1js.fromBER(exportedKey); | ||
try | ||
{ | ||
_this.fromSchema(asn1.result); | ||
} | ||
catch(exception) | ||
{ | ||
return Promise.reject("Error during initializing object from schema"); | ||
} | ||
return undefined; | ||
}, error => Promise.reject(`Error during exporting public key: ${error}`) | ||
return undefined; | ||
}, | ||
error => Promise.reject(`Error during exporting public key: ${error}`) | ||
); | ||
@@ -308,5 +306,4 @@ //endregion | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -77,2 +77,3 @@ import * as asn1js from "asn1js"; | ||
case "date": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return ((memberValue.year === 0) && | ||
@@ -79,0 +80,0 @@ (memberValue.month === 0) && |
@@ -37,3 +37,2 @@ import * as asn1js from "asn1js"; | ||
} | ||
//********************************************************************************** | ||
@@ -56,3 +55,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -103,3 +101,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -137,3 +134,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -168,3 +164,2 @@ /** | ||
} | ||
//********************************************************************************** | ||
@@ -182,5 +177,4 @@ /** | ||
} | ||
//********************************************************************************** | ||
} | ||
//************************************************************************************** |
@@ -860,22 +860,26 @@ import * as asn1js from "asn1js"; | ||
return true; | ||
}).then(result => | ||
{ | ||
//region Verify result of previous operation | ||
if(result === false) | ||
return false; | ||
//endregion | ||
if("signedAttrs" in this.signerInfos[signer]) | ||
}).then( | ||
/** | ||
* @param {ArrayBuffer} result | ||
*/ | ||
result => | ||
{ | ||
if(isEqualBuffer(result, messageDigestValue)) | ||
//region Verify result of previous operation | ||
if(result === false) | ||
return false; | ||
//endregion | ||
if("signedAttrs" in this.signerInfos[signer]) | ||
{ | ||
data = this.signerInfos[signer].signedAttrs.encodedValue; | ||
return true; | ||
if(isEqualBuffer(result, messageDigestValue)) | ||
{ | ||
data = this.signerInfos[signer].signedAttrs.encodedValue; | ||
return true; | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
return true; | ||
}); | ||
return true; | ||
}); | ||
//endregion | ||
@@ -882,0 +886,0 @@ |
@@ -90,2 +90,3 @@ import * as asn1js from "asn1js"; | ||
case "certID": | ||
// noinspection OverlyComplexBooleanExpressionJS | ||
return ((CertID.compareWithDefault("hashAlgorithm", memberValue.hashAlgorithm)) && | ||
@@ -92,0 +93,0 @@ (CertID.compareWithDefault("issuerNameHash", memberValue.issuerNameHash)) && |
@@ -424,6 +424,7 @@ import * as asn1js from "asn1js"; | ||
//region Calculate message digest for input "data" buffer | ||
// noinspection JSCheckFunctionSignatures | ||
sequence = sequence.then(() => | ||
crypto.digest(shaAlgorithm.name, new Uint8Array(data)) | ||
).then(result => | ||
isEqualBuffer(result, this.messageImprint.hashedMessage.valueBlock.valueHex) | ||
).then( | ||
result => isEqualBuffer(result, this.messageImprint.hashedMessage.valueBlock.valueHex) | ||
); | ||
@@ -430,0 +431,0 @@ //endregion |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4095262
61933