title: How to convert a private key to an RSA private key?
body: <p>Let me explain my question first. I bought a certificate from a CA and used the following format to generate the csr and the private key:</p>
  
  <pre><code>openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
  </code></pre>
  
  <p>When I open the server.key file, I see that it begins with "-----BEGIN PRIVATE KEY-----"</p>
  
  <p>I use the SSL cert on my server and everything looks fine.</p>
  
  <p>Now I want to upload the same cert to AWS IAM so that I can use it for by beanstalk load balancer. I use the following command from this aws doc <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/InstallCert.html#SubmitCSRCertAuth">http://docs.aws.amazon.com/IAM/latest/UserGuide/InstallCert.html#SubmitCSRCertAuth</a></p>
  
  <pre><code>iam-servercertupload -b public_key_certificate_file  -k privatekey.pem -s certificate_object_name
  </code></pre>
  
  <p>I change the cert file names as required but keep getting this error: "400 MalformedCertificate Invalid Private Key."</p>
  
  <p>The interesting thing is, on the aws doc page, the sample private key that they show starts with "-------Begin RSA Private Key--------"</p>
  
  <p>Is there a way to convert my private key to an RSA private key using openssl?</p>