Security Java Tutorial

import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
public class MainClass {
  public static void main(String args[]) throws Exception {
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    FileInputStream in = new FileInputStream(args[0]);
    Certificate c = cf.generateCertificate(in);
    in.close();
    String s = c.toString();
    FileOutputStream fout = new FileOutputStream("tmp.txt");
    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fout));
    out.write(s, 0, s.length());
    out.close();
  }
}