title: How to create certificate pfx file in java?
body: <p>I need to create certificate pfx file with password in java. I search in google and can create certificate "cer" file in <a href="http://www.java2s.com/Tutorial/Java/0490__Security/CreatingaSelfSignedVersion3Certificate.htm" rel="nofollow">http://www.java2s.com/Tutorial/Java/0490__Security/CreatingaSelfSignedVersion3Certificate.htm</a></p>
  
  <p>I add code in main</p>
  
  <pre><code>FileOutputStream fos = null;
  fos = new FileOutputStream("public.cer");
  fos.write(cert.getEncoded());
  fos.close();
  </code></pre>
  
  <p>this only work without password. </p>