KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to obtain the public key of a Certificate using the method: FileInputStream fin = new FileInputStream("PathToCertificate"); CertificateFactory f = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate)f.generateCertificate(fin); PublicKey pk = certificate.getPublicKey(); but I receive the following error: Exception in thread "main" java.lang.ClassCastException: sun.security.x509.X509CertImpl cannot be cast to codec.x509.X509Certificate at sergas_testcertificates.Main.main(Main.java:54) Does anyone know what this error is about? Thanks in advance
Tags (comma-separated)
Save Edits
Cancel