Only consider x509 certs in /.well-known/jwks API

This commit is contained in:
Yang Luo
2023-07-12 22:39:39 +08:00
parent 0d48da24dc
commit caec1d1bac
3 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,10 @@ func GetJsonWebKeySet() (jose.JSONWebKeySet, error) {
// link here: https://self-issued.info/docs/draft-ietf-jose-json-web-key.html
// or https://datatracker.ietf.org/doc/html/draft-ietf-jose-json-web-key
for _, cert := range certs {
if cert.Type != "x509" {
continue
}
certPemBlock := []byte(cert.Certificate)
certDerBlock, _ := pem.Decode(certPemBlock)
x509Cert, _ := x509.ParseCertificate(certDerBlock.Bytes)