@it-enterprise/digital-signature 1.3.15 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/DigitalSignature.js +2 -10
- package/src/Models.js +3 -0
- package/src/Utils.js +2 -1
package/package.json
CHANGED
package/src/DigitalSignature.js
CHANGED
|
@@ -208,6 +208,7 @@ export default class DigitalSignature {
|
|
|
208
208
|
"смарт-карта Техноконс. TEllipse3 (PKCS#11)",
|
|
209
209
|
"смарт-карта Техноконс. TEllipse",
|
|
210
210
|
"смарт-карта Техноконс. TEllipse2/3",
|
|
211
|
+
"е.ключ SIS DIAMOND",
|
|
211
212
|
"е.ключ SafeNet iKey (PKCS#11, RSA)",
|
|
212
213
|
"е.ключ Aruba Key (PKCS#11, RSA)"
|
|
213
214
|
]
|
|
@@ -816,16 +817,7 @@ export default class DigitalSignature {
|
|
|
816
817
|
message: this._resourses.BadParameter + " data"
|
|
817
818
|
};
|
|
818
819
|
}
|
|
819
|
-
|
|
820
|
-
const cert = Array.isArray(signerInfo) ? signerInfo[0] : signerInfo;
|
|
821
|
-
let hashAlgo = cert.infoEx.certHashType || signAlgoToHashAlgo(cert.infoEx.publicKeyType);
|
|
822
|
-
|
|
823
|
-
if (hashAlgo === EndUserConstants.EndUserCertHashType.GOST34311 && this._glSign.HashAlgorithm !== "GOST34311") {
|
|
824
|
-
hashAlgo = EndUserConstants.EndUserHashAlgo.DSTU7564_256;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
const hash = await this._euSign.HashData(hashAlgo, data);
|
|
828
|
-
return await this._euSign.VerifyHash(hash.val || hash, sign.val || sign, signIndex);
|
|
820
|
+
return await this._euSign.VerifyData(data.val || data, sign.val || sign, signIndex);
|
|
829
821
|
} else {
|
|
830
822
|
return await this._euSign.VerifyDataInternal(sign.val || sign, signIndex);
|
|
831
823
|
}
|
package/src/Models.js
CHANGED
|
@@ -441,6 +441,9 @@ export class PrivateKeyInfo {
|
|
|
441
441
|
if (hashType == EndUserConstants.EndUserHashAlgo.GOST34311 && glsign?.HashAlgorithm !== "GOST34311") {
|
|
442
442
|
return EndUserConstants.EndUserHashAlgo.DSTU7564_256;
|
|
443
443
|
}
|
|
444
|
+
if (hashType == EndUserConstants.EndUserHashAlgo.DSTU7564_256 && glsign?.HashAlgorithm === "GOST34311") {
|
|
445
|
+
return EndUserConstants.EndUserHashAlgo.GOST34311;
|
|
446
|
+
}
|
|
444
447
|
|
|
445
448
|
return hashType;
|
|
446
449
|
}
|
package/src/Utils.js
CHANGED
|
@@ -221,7 +221,8 @@ export function getSupportedSignAlgos(certificates, glsign = null) {
|
|
|
221
221
|
}
|
|
222
222
|
switch (certificate.infoEx.publicKeyType) {
|
|
223
223
|
case EndUserConstants.EndUserCertKeyType.DSTU4145:
|
|
224
|
-
if (certificate.infoEx.certHashType === EndUserConstants.EU_CERT_HASH_TYPE_GOST34311
|
|
224
|
+
if ((certificate.infoEx.certHashType === EndUserConstants.EU_CERT_HASH_TYPE_GOST34311 || certificate.infoEx.certHashType === EndUserConstants.EU_CERT_HASH_TYPE_DSTU7564_256)
|
|
225
|
+
&& glsign?.HashAlgorithm === "GOST34311") {
|
|
225
226
|
signAlgos.push(EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311);
|
|
226
227
|
} else {
|
|
227
228
|
signAlgos.push(EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564);
|