Suppose you're interested in establishing a TLS connection with a specific host, and won't be using any sort of CA, or x509 certificate chains - you only want to compare if the target host uses a specific certificate. How would you make this comparison?
Compare the thumbprints (apparently not recommended the thumbprint is SHA-1 and you want to be really careful). Compare the raw data? My first idea was to just compare the public keys, but I can't see this mentioned anywhere, so I'm not sure whether maybe I'm missing some problem with this.
I can imagine that someone could simply create a certificate that uses has the same public key by some sort of modification. The fake certificate could then possibly have different fields, and perhaps somehow, that could be used in some way... but regardless, in the context of TLS, I can't see why any of that would matter - if the public keys matches, it will be used for the handshake, and so the attacker won't be able to do anything (assuming they don't have the private key).