Closed titanism closed 10 months ago
It's the same key but a different representation, in this case, spki vs pkcs1. Previously mailauth always used the string representation of the key, but now it parses the key into a key object and, for the output, exports the key into a pem formatted key.
You should not compare keys based on string match but compare the actual values:
const { createPublicKey } = require('crypto');
let key1 = `-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEA1Lztpxs7yUxQEsbDFhjMc9kZVZu5P/COYEUIX4B39IL4SXAbv4vi
IlT9E6F6iZmTh1go7+9WQLywwgwjXMJx/Dz0RgMoPeyp5NRy4l320DPYibNqVMWa
5iQ2WiImQC0en1O9uhLLvzaSZJ03fvGmCo9jMo0GwKzLNe14xMgn/px2L5N/3IKl
KX4bqUAJTUt8L993ZlWzvgMnSFSt8B+euSKSrtAiopdy4r1yO4eN5goBASrGW0eL
Qc1lYouNvCrcTQpos4/GEAqiGzpqueJLmBfOO4clNvVvpPkvQs2BHw9I9LmIjaMx
TNGxkGBRaP3utDiKXXqu1K+LRzl0HCNSdQIDAQAB
-----END RSA PUBLIC KEY-----`;
let key2 = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1Lztpxs7yUxQEsbDFhjM
c9kZVZu5P/COYEUIX4B39IL4SXAbv4viIlT9E6F6iZmTh1go7+9WQLywwgwjXMJx
/Dz0RgMoPeyp5NRy4l320DPYibNqVMWa5iQ2WiImQC0en1O9uhLLvzaSZJ03fvGm
Co9jMo0GwKzLNe14xMgn/px2L5N/3IKlKX4bqUAJTUt8L993ZlWzvgMnSFSt8B+e
uSKSrtAiopdy4r1yO4eN5goBASrGW0eLQc1lYouNvCrcTQpos4/GEAqiGzpqueJL
mBfOO4clNvVvpPkvQs2BHw9I9LmIjaMxTNGxkGBRaP3utDiKXXqu1K+LRzl0HCNS
dQIDAQAB
-----END PUBLIC KEY-----`;
console.log(createPublicKey(key1).equals(createPublicKey(key2))); // true
@andris9 TY 🙏
It appears that there is a breaking change in v4.6.0 @andris9
Specifically the DKIM results have invalid
publicKey
values. You can see the result here has a part of the key that is present in therr
but not in the resultingpublicKey
:https://github.com/postalsys/mailauth/compare/v4.5.2...v4.6.0#diff-7f88797c7db38a6af7a3283e3af30f2cdd3c2489bd9c85a7a25b32ec2485f724R272-R292