I want to get an X509 certificate verified to make sure it was signed by the private key that corresponds to the public key:
var publicKey *rsa.PublicKey = getPublicKey()
var certificate *x509.Certificate = getCertificate()
certificate.CheckSignature(...)
It seems to me that certificate.CheckSignature
method is the right way to go but I can not figure out the parameters it needs and would like to ask for community's help.
Btw, I was able to do the same in java (working on two adjacent projects). It looks like this:
RSAPublicKey publicKey = getPublicKey();
X509Certificate certificate = X509CertUtils.parse(...);
// Verifies that this certificate was signed using the
// private key that corresponds to the specified public key.
certificate.verify(publicKey);
I appreciate any hints on the field! P.