首页 > 解决方案 > 如何将证书添加到 Kong。发出 https 请求

问题描述

我正在尝试使用此文档kong docs添加证书

但我无法弄清楚如何生成这些“证书”和“密钥”pem 文件。

我尝试使用 puttygen 生成的公钥和私钥,但没有锻炼。

一个样本将非常有帮助

{
"message": "3 schema violations (cert: invalid certificate: x509.cert.new: asn1_lib.c:101:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long; key: invalid key: pkey.new: tasn_dec.c:1130:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag; tags: expected a set)",
"name": "schema violation",
"fields": {
    "tags": "expected a set",
    "cert": "invalid certificate: x509.cert.new: asn1_lib.c:101:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long",
    "key": "invalid key: pkey.new: tasn_dec.c:1130:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag"
},
"code": 2
}

这是我收到的错误

标签: sslcertificatex509kong

解决方案


试试这个命令


    curl -i -X 'POST' http://localhost:8001/certificates \
    -F 'cert= Content PEM archive ' \
    -F 'key=  Content key archive without password ' \
    -F 'snis=subdomain.mydomain.com'

推荐阅读