forge
forge copied to clipboard
How to check whether the subject of a signed cert has been modified?
I understand that to verify if a cert has been signed by a caCert, you can do:
console.log(caCert.verify(cert));
However, this does not ensure that the subject of the cert has not been modified. What is the best way to ensure this? The only way I can think of is to re-sign the cert and check if the original signature matches the new signature, like so:
const signature = cert.signature;
cert.sign(caPrivateKey);
console.log(signature == cert.signature);
Is there a better way?