@it-enterprise/digital-signature 1.3.14 → 1.3.16
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 +10 -1
- 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
|
]
|
|
@@ -818,7 +819,15 @@ export default class DigitalSignature {
|
|
|
818
819
|
}
|
|
819
820
|
const signerInfo = await this._euSign.GetSigner(sign, signIndex, false);
|
|
820
821
|
const cert = Array.isArray(signerInfo) ? signerInfo[0] : signerInfo;
|
|
821
|
-
|
|
822
|
+
let hashAlgo = cert.infoEx.certHashType || signAlgoToHashAlgo(cert.infoEx.publicKeyType);
|
|
823
|
+
|
|
824
|
+
if (hashAlgo === EndUserConstants.EndUserCertHashType.GOST34311 && this._glSign.HashAlgorithm !== "GOST34311") {
|
|
825
|
+
hashAlgo = EndUserConstants.EndUserHashAlgo.DSTU7564_256;
|
|
826
|
+
}
|
|
827
|
+
if (hashAlgo === EndUserConstants.EndUserCertHashType.DSTU7564_256 && this._glSign.HashAlgorithm === "GOST34311") {
|
|
828
|
+
hashAlgo = EndUserConstants.EndUserHashAlgo.GOST34311;
|
|
829
|
+
}
|
|
830
|
+
|
|
822
831
|
const hash = await this._euSign.HashData(hashAlgo, data);
|
|
823
832
|
return await this._euSign.VerifyHash(hash.val || hash, sign.val || sign, signIndex);
|
|
824
833
|
} else {
|
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);
|