title: How can I create a .p12 or .pfx file without a private key?
body: <p>I'm trying to create a .p12 file that does not contain a valid identity (public key / private key pair) in order to test my app's certificate import functionality. Is it possible to do this with the <code>openssl</code> tool?</p>
  
  <p>I've tried</p>
  
  <pre><code>openssl pkcs12 -in client-certonly.pem -export -out client-certonly.p12
  </code></pre>
  
  <p>but I get an error:</p>
  
  <pre><code>unable to load private key
  471:error:0906D06C:PEM routines:PEM_read_bio:no start line:/SourceCache/OpenSSL098/OpenSSL098-50/src/crypto/pem/pem_lib.c:648:Expecting: ANY PRIVATE KEY
  </code></pre>
  
  <p>If it isn't possible to do this with <code>openssl</code>, is there another tool I can use?</p>