Add number of certs to return and fix CR LF in CACaps

This commit is contained in:
Herman Slatman 2021-02-19 12:06:24 +01:00
parent 165f6a1ccd
commit 702032f2b7
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F

View file

@ -222,6 +222,7 @@ func (h *Handler) GetCACert(w http.ResponseWriter, r *http.Request, scepResponse
scepResponse.CACertNum = 1 scepResponse.CACertNum = 1
} else { } else {
data, err := microscep.DegenerateCertificates(certs) data, err := microscep.DegenerateCertificates(certs)
scepResponse.CACertNum = len(certs)
scepResponse.Data = data scepResponse.Data = data
scepResponse.Err = err scepResponse.Err = err
} }
@ -335,7 +336,7 @@ func createKeyIdentifier(pub crypto.PublicKey) ([]byte, error) {
} }
func formatCapabilities(caps []string) []byte { func formatCapabilities(caps []string) []byte {
return []byte(strings.Join(caps, "\n")) return []byte(strings.Join(caps, "\r\n"))
} }
// writeSCEPResponse writes a SCEP response back to the SCEP client. // writeSCEPResponse writes a SCEP response back to the SCEP client.
@ -350,7 +351,7 @@ func writeSCEPResponse(w http.ResponseWriter, response SCEPResponse) error {
} }
var ( var (
// TODO: check the default capabilities // TODO: check the default capabilities; https://tools.ietf.org/html/rfc8894#section-3.5.2
defaultCapabilities = []string{ defaultCapabilities = []string{
"Renewal", "Renewal",
"SHA-1", "SHA-1",