Sometimes, there is confusion on what to keep or remove of the stuff" before any of the following lines signifying the start of the private key: (From now on will call this "the Begin line":)
--------BEGIN RSA PRIVATE KEY-------------------------- (PKCS#5 Plain Private Key)
--------BEGIN PRIVATE KEY-------------------------------- (PKCS#8 Plain Private Key)
--------BEGIN ENCRYPTED RSA PRIVATE KEY------------- (PKCS#5 Encrypted Private Key)
--------BEGIN ENCRYPTED PRIVATE KEY---------------- (PKCS#8 Encrypted Private Key)
This Knowledge Document gives some general guidance.
I have a new Private Key. Do I remove any of the lines that appear before the start of the private key?
Generally, yes you can remove the lines before and after the "Begin RSA Private Key" and "End RSA Private Key (and the like.) This includes Microsoft
IIS servers which add some additional information lines.
The only exception is Begin Encrypted Private Key which may have its own section before the Begin Private Key line. But usually the
"Proc-Type: 4,ENCRYPTED" line is part of Private Key Section such as below and should be retained:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,E83B4219157F23G9
Also watch leading and trailing blanks at the start or end of the Begin or End lines.