Ok. So I removed the header section from you example pem file and converted it to a der file and it produced the same result as when it had the header. So it seems like the header is not used.
I've converted your example certificate file and got the same results using:
openssl x509 -inform pem -in Certificate.pem -outform der -out Certificate.der
But when I convert your example key file I do not get the same results. I'm using:
openssl rsa -inform pem -in PrivateKey.pem -outform der -out PrivateKey.der
Are there any other parameters that I'm missing to produce the same result for the key file?
Here are the results for converting your example key.pem file:
The pem.key file:
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDNrN1H7L63JMNjG1SYeeHHMRZZ1p13nY3ii+0EF7LG6+Sbkb4x
UGKXWLV/Kd6zcSQLv5cJfybcLeyoLrJkK3orNRktooDLmf2UcRsjjVTbLmKNgQgt
9CRyJ2z5yY7bTHW6mwH4Pxj05n/7V5SSzIjEtADCqtTliBizES9zwNYpCQIDAQAB
AoGAUjU9ASmklSlxm2RqLMPStb5uE5yPtibYdmu9YbxjLdVNu8zGO4nIznubl+dR
Z2HaqYN7yET1cF4+0H5RuW4TVwhc4WdPYV6lCewR3eS4tPTgYzRM2jIgH4VBXbzb
JMWvvgJfIvF8zAVWpqY3muv/Ui2/MEuaHe6rnCziwbidyTECQQDpiRbNrC7yTWYX
vXgSEo2OhCTeLVBBhYw0Cfr7bYdRTBMo8GARhj3CpM9exW9bETIKtSjQgkdEJpLi
eFm0CLP9AkEA4XW0arWMEfvMQgLF2kjOKUMUAZoss6TLc+uhNVettRYXgANfMje+
om/5MYS/AG6NAw4wHNAvN/B+wmS/7kvo/QJBAOGZiyvYn+l2l59rayiaP6FjSnJO
9+6z4kMLOSfWIRiKEyBDRaroMZVsvN7if7ZLoDnz05/JmqrdUJvyg0WF+skCQQCv
sMd8+ChEw1Dyh7KiXWW6JblrXjdDbkHU/WNMbBzDJon9iaMfQO1fK56mhelJbtyX
6vB3I4wILXK6DUS7b5AJAkEAkeQuyowKaS9i4mI7pY1aLFY+f2dCkhKSX/OX3eGp
f60uLfRKV7N6EL3X5OxqCCHp8kZJ0mlHiiBL8rFSg6tvEA==
-----END RSA PRIVATE KEY-----
My conversion result (key.der):
0‚x 0
*†H†÷
‚b0‚^ ͬÝGì¾·$ÃcT˜yáÇ1YÖwâ‹í²Æë䛑¾1Pb—Xµ)Þ³q$¿— &Ü-ì¨.²d+z+5-¢€Ë™ý”q#TÛ.b-ô$r'lùÉŽÛLuº›ø?ôæûW”’̈Ĵ ªÔ刳/sÀÖ) €R5=)¤•)q›dj,ÃÒµ¾nœ¶&Øvk½a¼c-ÕM»ÌÆ;‰ÈÎ{›—çQgaÚ©ƒ{ÈDõp^>Ð~Q¹nW\ágOa^¥ ìÝ临ôàc4LÚ2 …A]¼Û$ů¾_"ñ|ÌV¦¦7šëÿR-¿0Kšî«œ,âÁ¸É1A é‰Í¬.òMf½xŽ„$Þ-PA…Œ4 úûm‡QL(ð`†=¤Ï^Åo[2
µ(ЂGD&’âxY´³ýA áu´jµŒûÌBÅÚHÎ)Cš,³¤Ësë¡5Wµ€_27¾¢où1„¿ n0Ð/7ð~Âd¿îKèýA ᙋ+ØŸév—Ÿkk(š?¡cJrN÷î³âC9'Ö!Š CEªè1•l¼Þâ¶K 9óÓŸÉšªÝP›òƒE…úÉA ¯°Ç|ø(DÃPò‡²¢]eº%¹k^7CnAÔýcLlÃ&‰ý‰£@í_+ž¦…éInÜ—êðw#Œ-rº
D»o A ‘ä.ÊŒ
i/bâb;¥Z,V>gB’’_ó—Ýá©.-ôJW³z½×äìj!éòFIÒiGŠ Kò±Rƒ«o
Your example key.der:
0‚^ ͬÝGì¾·$ÃcT˜yáÇ1YÖwâ‹í²Æë䛑¾1Pb—Xµ)Þ³q$¿— &Ü-ì¨.²d+z+5-¢€Ë™ý”q#TÛ.b-ô$r'lùÉŽÛLuº›ø?ôæûW”’̈Ĵ ªÔ刳/sÀÖ) €R5=)¤•)q›dj,ÃÒµ¾nœ¶&Øvk½a¼c-ÕM»ÌÆ;‰ÈÎ{›—çQgaÚ©ƒ{ÈDõp^>Ð~Q¹nW\ágOa^¥ ìÝ临ôàc4LÚ2 …A]¼Û$ů¾_"ñ|ÌV¦¦7šëÿR-¿0Kšî«œ,âÁ¸É1A é‰Í¬.òMf½xŽ„$Þ-PA…Œ4 úûm‡QL(ð`†=¤Ï^Åo[2
µ(ЂGD&’âxY´³ýA áu´jµŒûÌBÅÚHÎ)Cš,³¤Ësë¡5Wµ€_27¾¢où1„¿ n0Ð/7ð~Âd¿îKèýA ᙋ+ØŸév—Ÿkk(š?¡cJrN÷î³âC9'Ö!Š CEªè1•l¼Þâ¶K 9óÓŸÉšªÝP›òƒE…úÉA ¯°Ç|ø(DÃPò‡²¢]eº%¹k^7CnAÔýcLlÃ&‰ý‰£@í_+ž¦…éInÜ—êðw#Œ-rº
D»o A ‘ä.ÊŒ
i/bâb;¥Z,V>gB’’_ó—Ýá©.-ôJW³z½×äìj!éòFIÒiGŠ Kò±Rƒ«o