# Elasticsearch P12 certs error

**URL:** <https://discuss.elastic.co/t/elasticsearch-p12-certs-error/287367>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [October 21, 2021, 9:08pm UTC](https://discuss.elastic.co/t/elasticsearch-p12-certs-error/287367 "2021-10-21T21:08:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_99](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@john\_99](https://discuss.elastic.co/u/john_99)\
**Post date:** [October 21, 2021, 9:08pm UTC](https://discuss.elastic.co/t/elasticsearch-p12-certs-error/287367/1 "2021-10-21T21:08:40Z")

</div>

Hi Team,

I am getting some errors while renewing the p12 certs.

I followed the below steps:  
Ste: 1 cd /usr/share/Elasticsearch  
Step 2: ./bin/Elasticsearch-certutil ca  
Step 3: ./bin/Elasticsearch-certutil cert --ca elastic-stack-ca.p12

Elasticsearch]# openssl pkcs12 -in elastic-certificates.p12 -out certificate.pem -nodes  
Enter Import Password:  
MAC verified OK  
[Elasticsearch]# cat certificate.pem | openssl x509 -noout -enddate  
notAfter=Oct 20 20:32:49 2024 GMT

everything seems ok here with validity, and I created one of the node and did scp into all nodes.  
once I placed the new certs in /etc/Elasticsearch/elastic-stack-ca.p12 & elastic-certificates.p12  
Elasticsearch is throwing the error with commend  
GET /\_xpack/ssl/certificates  
{  
"error": {  
"root\_cause": [  
{  
"type": "i\_o\_exception",  
"reason": "keystore password was incorrect"  
}  
],  
"type": "i\_o\_exception",  
"reason": "keystore password was incorrect",  
"caused\_by": {  
"type": "unrecoverable\_key\_exception",  
"reason": "failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption."  
}  
},  
"status": 500  
}

It's a high priority, can someone help me as quickly as possible, please?

---

<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:** [November 18, 2021, 9:09pm UTC](https://discuss.elastic.co/t/elasticsearch-p12-certs-error/287367/2 "2021-11-18T21:09:10Z")

</div>

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