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r12dKpB08j1Ikk12kA/IWt
6QDE/v/BvLxZljivkCflBskn1q9FtV2sEX9krKNDmgY=
-----END CERTIFICATE-----
Decoding the cert shows the signature and certificate algorithm is `sha1WithRSAEncryption (PKCS #1). Using Charles Engelke's excellent tutorial and code also shows that the cert says it uses '1.2.840.113549.1.1.5', which is SHA-1 in this reference lookup page.
However, when passing the key into crypto.subtle.verify()
in JS (MDN reference) to verify a JWT signature, I needed to pass in {name: "RSASSA-PKCS1-v1_5", hash: {name: 'RS256}}
, as specified by the JWT's header, instead of SHA-1 as per the public cert.
Why is this? Does the cert's signature algorithm have any relevance to the signature being checked?