title: "No DEK-Info header in block" when attempting to read encrypted private key
body: <p>I'm trying to read an encrypted PKCS8 private key file. I generated the keys like this:</p>
  
  <pre><code>openssl genrsa -out file.pem -passout pass:file -aes256 1024
  openssl pkcs8 -topk8 -inform pem -in file.pem -outform pem -out filePKCS8.pem
  </code></pre>
  
  <p>And I try reading it in Go this way:</p>
  
  <pre><code>block, _ := pem.Decode(key)
  return x509.DecryptPEMBlock(block, password)
  </code></pre>
  
  <p>But I get an error saying:</p>
  
  <pre><code>x509: no DEK-Info header in block
  </code></pre>
  
  <p>However, I can't figure out what's going wrong. Am I generating the key wrong or am I using the wrong library? I see libraries specifically for reading unencrypted PKCS8 files but none for encrypted PKCS8 files specifically.</p>
  
  <p>Does anyone have any idea?</p>