Let us say I have a certificate and a private key pair (C1, K1) Now, lets say I received a Certificate, C2 on the wire. Now, I want to know whether the pvt-key K1 corresponds to the private key of C2. One method is encrypt a Known random number with pub-key in C2 and decrypt with K1 and see if the number is same. But this is expensive.
I thought of another method and wanted to know if this is correct: Do a byte-for-byte compare of the pub-key in C1 with that of C2. If they are same, then we can assume that K1 must be the private-key of C2. Am I correct?
