Getting Public Key From Certificate Returns Sun RSA key
843811Feb 2 2010 — edited Feb 2 2010Hello there,
I am currently using the MSCAPI provider to gain access to my keystore. I am able to succesfully connect to my keystore and pull out a certificate.
Certificate c = ks.getCertificate(alias); //where alias is one of the certs
Then i try and get the public key by running:
PublicKey pubKey = (PublicKey) c.getPublicKey();
but all that returns is:
Sun RSA public key, 1024 bits
modulus: 141343717872248206799277866097484396599853966231319659204423022613135736949845218486987094969917446071457692560919565363009417439941259102304655737584937294717038071048695685567721047637021137784572011150639979053592800909847527338979352499474109603600768053926448928441216989390565098043045779314589357738433
public exponent: 65537
Which is not the public key assosiated with that certificate. for example:
c.verify(pubKey);
throws a "Signature does not match" exception.
Any ideas on why i am not getting the correct public key?
Thanks.