Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions traffic_ops/traffic_ops_golang/deliveryservice/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package deliveryservice
*/

import (
"bytes"
"crypto/x509"
"database/sql"
"encoding/base64"
Expand Down Expand Up @@ -327,12 +326,14 @@ func verifyCertificate(certificate string, rootCA string) (string, bool, error)
}
pemEncodedChain := ""
for _, link := range chain[0] {
// Only print non-self signed elements of the chain
if link.AuthorityKeyId != nil && !bytes.Equal(link.AuthorityKeyId, link.SubjectKeyId) {
block := &pem.Block{Type: "CERTIFICATE", Bytes: link.Raw}
pemEncodedChain += string(pem.EncodeToMemory(block))
}
}
// Include all certificates in the chain, since verification was successful.
block := &pem.Block{Type: "CERTIFICATE", Bytes: link.Raw}
pemEncodedChain += string(pem.EncodeToMemory(block))
}

if len(pemEncodedChain) < 1 {
return "", false, errors.New("Invalid empty certicate chain in request")
}

return pemEncodedChain, false, nil
}