func PostCA(store *liftca.Store, r *ht.Request) *ht.Answer { caReq := &JSONCARequest{} err := r.BodyAsJSON(caReq) if err != nil { return ht.Failure(err) } var id int64 if caReq.PEMCertificate != "" || caReq.PEMKey != "" || caReq.PEMKeyPassword != "" { id, err = store.AddExistingCA(caReq.Visible, []byte(caReq.PEMCertificate), []byte(caReq.PEMKey), []byte(caReq.PEMKeyPassword)) } else { id, err = store.AddCA(caReq.Visible, caReq.Name) } if err != nil { return ht.Failure(err) } return ht.RedirectTo(CAUrl(id)) }