Hi Dave,
I'm trying to read in a CSR from an external .PEM file using the following code:
PEMReader in2 = null;
in2 = new PEMReader(new InputStreamReader(new FileInputStream("csr.pem")));
PKCS10CertificationRequest csr2 = (PKCS10CertificationRequest) in2.readObject();
However whenever this code is called a get the following exception:
Exception in thread "main" java.lang.ClassCastException: org.bouncycastle.jce.PKCS10CertificationRequest cannot be cast to org.bouncycastle.pkcs.PKCS10CertificationRequest
If I move the code snippet and run it in a separate project it works fine!
Also if I use this:
PEMReader in2 = null;
in2 = new PEMReader(new InputStreamReader(new FileInputStream("/Users/CarlBourne/Downloads/PEMTest/csr.pem")));
CertificationRequest csr2 = (CertificationRequest) in2.readObject();
It works fine with regards to reading in the .PEM file but it's not then compatible with JSEP which uses PKCS10CertificationRequest.
I also noticed that PKCS10CertificationRequest is deprecated in favour of CertificationRequest, so I was wondering if I should change my code to use this instead?
Regards,
Carl