Skip to content

Commit

Permalink
fix: Incorrect signature algorithm for SignedData verification
Browse files Browse the repository at this point in the history
  • Loading branch information
microshine committed Jul 22, 2024
1 parent cd4932b commit 6e09000
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SignedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ export class SignedData extends PkiObject implements ISignedData {
// This adjustment is specifically for cases where the signature algorithm is rsaEncryption.
// In such cases, we rely on the hash mechanism defined in signerInfo.digestAlgorithm for verification.
const verifyResult = signerInfo.signatureAlgorithm.algorithmId === "1.2.840.113549.1.1.1"
? await crypto.verifyWithPublicKey(data, signerInfo.signature, signerCert.subjectPublicKeyInfo, signerCert.signatureAlgorithm, shaAlgorithm)
: await crypto.verifyWithPublicKey(data, signerInfo.signature, signerCert.subjectPublicKeyInfo, signerCert.signatureAlgorithm);
? await crypto.verifyWithPublicKey(data, signerInfo.signature, signerCert.subjectPublicKeyInfo, signerInfo.signatureAlgorithm, shaAlgorithm)
: await crypto.verifyWithPublicKey(data, signerInfo.signature, signerCert.subjectPublicKeyInfo, signerInfo.signatureAlgorithm);

//#region Make a final result

Expand Down

0 comments on commit 6e09000

Please sign in to comment.