The private key could not be processed. Key should be unencrypted and in PEM format

Trying to add custom private key for certificate.
Extension of the private key is *.key,
file content starts from -----BEGIN PRIVATE KEY-----

Program shows that private key file format didn’t match, and unencrypted PEM is needed.

How can I fix this?

Thanks!

Hi, can you confirm what type of key this is (RSA or EC)? Can it be parsed OK using any PEM decoder tool? How was it generated?

Our code simply tries to parse the key file as PEM format, the main limitation is that the key file can’t be password protected. This uses the BouncyCastle OpenSssl implementation.

If you can generate keys on demand, could you supply an example key that doesn’t work? i.e. one that’s not actually private.

Key is generated by mail server, thats all i know.
Thanks for the tip about PEM decoder tool,
i’ll try to generate new private key, that matches this tool.

Example key, that doesn’t work is here

(this key is not actualy private)

Thanks, so if I run this through openssl it seems to be valid but that the original is not-quite correct base64 encoding (or rather, BouncyCastle can’t/doesn’t want to parse it):

openssl rsa -in C:\temp\key.pem -check

Which then gives me an output which works with Certify:

-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAmYq/PAL1ZqBY5EIeyBC46heEop9zTkX9sggnl9TR3RZ00Gh6
JLAZSWCHTMob2eueTO/mtHGhK99v1rKxZlp/QQ0vH3V8WCyyZ11X0B9l63pGHcxc
TSTNNxnuVL7MePyjrPCvmFYyz39Hd6lb3/xy76o99kBUIweFCqLuQbZKYBOSYxZw
+X81H+mkAmisWd6NLTwigmiHs1lWITtlEAsDe1i6eZ3mWeQXJl3f0qquZ//F6kZE
hxtvVG7EgAI/c4vyNFuWEoHxLlsOt5evtOO26eBSAqrIsAt2mfJZkqrzgvtDkf5B
fXPLRKF/y2t/1JD7pI2SRNyKC1RJ8Rfhwh8kmwIDAQABAoIBAA0XyEPhSrTUIpBg
VQihaGtJ0x0c9LOtgzstt9aaJsUwF4j4B8ZeH+Hicdcp+uMD1Q1hfa5QbDp2BK7t
sPP17pkI+0Y2+gH42cO3sXfFXacNV7JNzWckpr02oFyoon4EqR5jrc2TOCT6iQka
r4Nznwdx4HPBu4r7JqyoBSIkXcZAcyUw+yk9ghu1iYH8Wxx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RSA PRIVATE KEY-----

Which email server product is this, maybe I can investigate it a little with them?

This is Zimbra Collaboration server.
Thanks for help,
private key for mail server i’v regenerate whith mathched parameters and replace it in console of mail server.