forge icon indicating copy to clipboard operation
forge copied to clipboard

bug: subject/issuer hash calculation incompatibility

Open simhnna opened this issue 2 years ago • 0 comments
trafficstars

https://github.com/digitalbazaar/forge/blob/main/lib/x509.js#L1377 and https://github.com/digitalbazaar/forge/blob/main/lib/x509.js#L1393

vs

https://github.com/digitalbazaar/forge/blob/main/lib/x509.js#L2824

AFAIK the first two use the raw bytes of the attributes while the second uses the string contents of type and value of the attributes

This causes certificates that are directly generated by code and added to a CA to have a different hash than the same certificate after a pem encode/decode operation

Not sure which hash is the correct one

Here are two commits, one adding a failing test and the other fixing the test (but failing the existing hash calculation test) https://github.com/simhnna/forge/tree/failing-test

simhnna avatar Jun 15 '23 07:06 simhnna