使用 .p12 证书和密码连接到 Elasticsearch

Connect to Elasticsearch with a .p12 certificate and a password

我想使用 Nodejs 连接到 Elasticsearch 服务器。作为先决条件,我已收到 .p12 证书和密码,但我不知道如何使用此凭据新建客户端对象。在 node.js official documentation 中使用 .pem 文件并且没有密码。如何使用 nodejs Elasticsearch 库实现此目的?

我找到选项:

  1. 将 .p12 文件转换为 .pem 文件see the details
  2. 正在使用密码读取 .p12 文件 see the details