# Looks like you either have a bad certificate, an invalid key or your private key was not in PKCS8 format

**URL:** <https://discuss.elastic.co/t/looks-like-you-either-have-a-bad-certificate-an-invalid-key-or-your-private-key-was-not-in-pkcs8-format/218856>\
**Category:** Logstash\
**Tags:** elastic-stack-security\
**Created:** [February 11, 2020, 7:58pm UTC](https://discuss.elastic.co/t/looks-like-you-either-have-a-bad-certificate-an-invalid-key-or-your-private-key-was-not-in-pkcs8-format/218856 "2020-02-11T19:58:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gowthamgts](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gowthamgts/32/62477_2.png) [@gowthamgts](https://discuss.elastic.co/u/gowthamgts)\
**Post date:** [February 11, 2020, 7:58pm UTC](https://discuss.elastic.co/t/looks-like-you-either-have-a-bad-certificate-an-invalid-key-or-your-private-key-was-not-in-pkcs8-format/218856/1 "2020-02-11T19:58:40Z")

</div>

I'm trying to enable tls security for my stack and keep getting `Looks like you either have a bad certificate, an invalid key or your private key was not in PKCS8 format.` errors even though I've given my keys in pkcs8 format. Can someone please help?

I followed this to generate the certificates:

> <https://gist.github.com/rishiloyola/79f869749bf54d135f7f6fe61e0e99a7>

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [February 11, 2020, 9:18pm UTC](https://discuss.elastic.co/t/looks-like-you-either-have-a-bad-certificate-an-invalid-key-or-your-private-key-was-not-in-pkcs8-format/218856/2 "2020-02-11T21:18:07Z")

</div>

Please share _your_ configuration, _exactly_ how you created _your_ certificates and keys and the error as you get it in your logs. This will make it much easier for folks that can assist you, to actually do so.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2020, 9:18pm UTC](https://discuss.elastic.co/t/looks-like-you-either-have-a-bad-certificate-an-invalid-key-or-your-private-key-was-not-in-pkcs8-format/218856/3 "2020-03-10T21:18:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
