public static void saveX509Cert(String certStr,File certFile) throws IOException {
  BufferedWriter writer=new BufferedWriter(new FileWriter(certFile));
  writer.write(BEGIN_CERT);
  writer.newLine();
  writer.write(certStr);
  writer.newLine();
  writer.write(END_CERT);
  writer.newLine();
  writer.close();
}

public static void saveX509Cert ( String certStr , File certFile ) throws IOException { BufferedWriter writer = new BufferedWriter ( new FileWriter ( certFile ) ) ; writer . write ( BEGIN_CERT ) ; writer . newLine ( ) ; writer . write ( certStr ) ; writer . newLine ( ) ; writer . write ( END_CERT ) ; writer . newLine ( ) ; writer . close ( ) ; }
save a certificate to a file in base 64 binary format with begin and end strings
