title: OpenSSL unable to load Public Key
body: <p>Trying to encrypt a text message via command line on OSX Yosomite 10.10.2</p>
  
  <p>Created public <code>.pem</code> key like this:</p>
  
  <pre><code>ssh-keygen -f ~/.ssh/id_rsa.pub -e -t PKCS8 &gt; id_rsa.pem
  </code></pre>
  
  <p>If I try to encrypt myMessage.txt</p>
  
  <pre><code>openssl rsautl -encrypt -inkey ~/.ssh/id_rsa.pem -pubin -in ~/Desktop/myMessage.txt -out ~/Desktop/encrypted.txt
  </code></pre>
  
  <p>I get <code>unable to load Public key</code></p>
  
  <p>If I then type:</p>
  
  <pre><code>openssl asn1parse -in id_rsa.pem
  </code></pre>
  
  <p>Returns: <code>Error: offset too large</code></p>
  
  <p>But I have no idea how to fix it.
  What should I change to make it work?</p>