// GetCACert returns the CA certificates in a SCEP response
GetCACert returns the CA certificates in a SCEP response
// GetCACert returns the CA certificates in a SCEP response
func (h *Handler) GetCACert(ctx context.Context) (SCEPResponse, error) {
	certs, err := h.Auth.GetCACertificates()
	if err != nil {
		return SCEPResponse{}, err
	}
	if len(certs) == 0 {
		return SCEPResponse{}, errors.New("missing CA cert")
	}
	response := SCEPResponse{
		Operation: opnGetCACert,
		CACertNum: len(certs),
	}
	if len(certs) == 1 {
		response.Data = certs[0].Raw
	} else {
		data, err := microscep.DegenerateCertificates(certs)
		if err != nil {
			return SCEPResponse{}, err
		}
		response.Data = data
	}
	return response, nil
}
func ( h * Handler ) GetCACert ( ctx context . Context ) ( SCEPResponse , error ) { certs , err := h . Auth . GetCACertificates ( ) if err != nil { return SCEPResponse { } , err } if len ( certs ) == 0 { return SCEPResponse { } , errors . New ( " " ) } response := SCEPResponse { Operation : opnGetCACert , CACertNum : len ( certs ) , } if len ( certs ) == 1 { response . Data = certs [ 0 ] . Raw } else { data , err := microscep . DegenerateCertificates ( certs ) if err != nil { return SCEPResponse { } , err } response . Data = data } return response , nil }
GetCACert returns the CA certificates in a SCEP response
GetCACert returns the CA certificates in a SCEP response
// create degenerate pkcs7 certificate structure, according to // https://tools.ietf.org/html/rfc8894#section-4.2.1.2, because // not signed or encrypted data has to be returned.