Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Verify Certificate - Signature does not match.

843811Apr 15 2003 — edited Apr 17 2003
I'm trying to work with Digital IDs from Verisign for S/MIME. I must however be doing something very wrong as I'm not getting very far.

I downloaded from Verisign the recipient's Certificate/Digital ID.
So far so good, I can use CertificateFactory to load in the file.

Problem I'm having is that I can't verify the Certificate. The error message is:
Exception in thread "main" java.security.SignatureException: Signature does not match.
        at sun.security.x509.X509CertImpl.verify(X509CertImpl.java:400)
        at sun.security.x509.X509CertImpl.verify(X509CertImpl.java:363)
        at TestCertificate.main(TestCertificate.java:23)
Here's the code snippet I'm using:
        String filename = "base64.cer";
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        FileInputStream fis = new FileInputStream(filename);
        BufferedInputStream bis = new BufferedInputStream(fis);
        Certificate cert = null;
        while (bis.available() > 0) 
        {
            cert = cf.generateCertificate(bis);
            System.out.println(cert.toString());
        }
        
        PublicKey key = cert.getPublicKey();
        cert.verify(key);
Why wouldn't a certificate verify?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2003
Added on Apr 15 2003
1 comment
4,048 views