I have three kinds of files to decode namely .csr and .der and .key files.I am able to decode .der file using the java as below. public class Base64Decoder {
public static void main(String[] args) throws FileNotFoundException, IOException {
    Certificate cert=null;
try{
 FileInputStream fis = new FileInputStream("C:/Users/patillat/Downloads/device-ee/csr/00db1234567890A5-ka.der");
 BufferedInputStream bis = new BufferedInputStream(fis);
 CertificateFactory cf = CertificateFactory.getInstance("X.509");
 while (bis.available() > 0) {
    cert = cf.generateCertificate(bis);
    try {
        System.out.println("-----BEGIN CERTIFICATE-----");
        System.out.println(DatatypeConverter.printBase64Binary(cert.getEncoded()));
        System.out.println("-----END CERTIFICATE-----");
        //System.out.println("key:"+cert.getPublicKey());
    } catch (CertificateEncodingException e) {
        e.printStackTrace();
    }
    System.out.println(cert.toString());
 }
}
catch(Exception e)
{
    e.printStackTrace();
}
}
}
I am able to generate details of .der certificate
In the same way I am not able to decode my .csr file. Are there any other ways to decode .csr files?
                        
Using BouncyCastle you can easily decode a csr, from binary format.
JcaPKCS10CertificationRequest p10Object = new JcaPKCS10CertificationRequest(byte[] csrBytes);
There are also htlper classes for decoding/decoding to/from PEM format (base64 encoded).