code: func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) error {
  	log.Info("signature request received")
  
  	body, err := ioutil.ReadAll(r.Body)
  	if err != nil {
  		return err
  	}
  	r.Body.Close()
  
  	var req jsonSignRequest
  
  	err = json.Unmarshal(body, &req)
  	if err != nil {
  		return errors.NewBadRequestString("Unable to parse sign request")
  	}
  
  	signReq := jsonReqToTrue(req)
  
  	if req.Request == "" {
  		return errors.NewBadRequestString("missing parameter 'certificate_request'")
  	}
  
  	var cert []byte
  	profile, err := signer.Profile(h.signer, req.Profile)
  	if err != nil {
  		return err
  	}
  
  	if profile.Provider != nil {
  		log.Error("profile requires authentication")
  		return errors.NewBadRequestString("authentication required")
  	}
  
  	cert, err = h.signer.Sign(signReq)
  	if err != nil {
  		log.Warningf("failed to sign request: %v", err)
  		return err
  	}
  
  	result := map[string]interface{}{"certificate": string(cert)}
  	if req.Bundle {
  		if h.bundler == nil {
  			return api.SendResponseWithMessage(w, result, NoBundlerMessage,
  				errors.New(errors.PolicyError, errors.InvalidRequest).ErrorCode)
  		}
  
  		bundle, err := h.bundler.BundleFromPEMorDER(cert, nil, bundler.Optimal, "")
  		if err != nil {
  			return err
  		}
  
  		result["bundle"] = bundle
  	}
  	log.Info("wrote response")
  	return api.SendResponse(w, result)
  }
docs: // Handle responds to requests for the CA to sign the certificate request
  // present in the "certificate_request" parameter for the host named
  // in the "hostname" parameter. The certificate should be PEM-encoded. If
  // provided, subject information from the "subject" parameter will be used
  // in place of the subject information from the CSR.