title: How to get .pfx file from .cer and .key?
body: <p>Before questioning here. I've searched a lot about my problem. And problem is still exists. Below is the references of posts, which I've already read.</p>
  
  <p><a href="https://stackoverflow.com/questions/6307886/how-to-create-pfx-file-from-certificate-and-private-key">How to create .pfx file from certificate and private key?
  </a></p>
  
  <p><a href="https://stackoverflow.com/questions/808669/convert-a-cert-pem-certificate-to-a-pfx-certificate">Convert a CERT/PEM certificate to a PFX certificate
  </a></p>
  
  <p><a href="https://stackoverflow.com/questions/991758/how-to-get-pem-file-from-key-and-crt-files">How to get .pem file from .key and .crt files?
  </a></p>
  
  <p><a href="https://stackoverflow.com/questions/29490922/how-to-generate-a-pfx-file-from-a-cer-file">How to generate a .pfx file from a .cer file?</a></p>
  
  <p><strong>Overview</strong></p>
  
  <p>I'm working on:</p>
  
  <blockquote>
    <p>Windows 10 64bit</p>
    
    <p>IIS (Version 10.0.16299.15)</p>
    
    <p>I've installed Win32 OpenSSL v1.1.0g</p>
  </blockquote>
  
  <p>These are the files that I have available:</p>
  
  <ul>
  <li><p>server.cer</p></li>
  <li><p>server.key</p></li>
  </ul>
  
  <p><strong>What I've tried?</strong></p>
  
  <p>I have also tried various things from trawling through posts but my lack of experience in this area is really impeding my efforts.</p>
  
  <p>Below commands I have tried in Terminal to create my <code>server.key</code> and <code>server.cer</code> file.</p>
  
  <pre><code>set RANDFILE=c:\certificate\.md
  
  set OPENSSL_CONF=c:\OpenSSL-Win32\bin\openssl.cfg
  
  c:\OpenSSL-Win32\bin\openssl.exe genrsa -out server.key 2048`
  
  c:\OpenSSL-Win32\bin\openssl.exe req -new -key server.key -out server.cer -config C:\OpenSSL-Win32\bin\openssl.cfg
  
  c:\OpenSSL-Win32\bin\openssl.exe pkcs12 -export -in server.cer -inkey server.key -out server.pfx
  </code></pre>
  
  <p><strong>Output</strong>
  <a href="https://i.stack.imgur.com/0B4OU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0B4OU.png" alt="enter image description here"></a></p>
  
  <p><strong>Error:</strong> unable to load certificates</p>
  
  <p><strong>What I want?</strong></p>
  
  <p>How to create .pfx file from certificate and private key? Let me know what I'm doing wrong in my code.</p>