func GetCert(store *liftca.Store, r *ht.Request) *ht.Answer { ca, cert, answer := ObtainCAAndCert(store, r) if answer != nil { return answer } return ht.JSONDocument(JSONCertResponseFromParcel(ca.SerialNumber(), cert)) }
func GetCA(store *liftca.Store, r *ht.Request) *ht.Answer { ca, answer := ObtainCA(store, r) if answer != nil { return answer } auth, _ := store.Get(ca.SerialNumber()) return ht.JSONDocument(*JSONCAResponseFromParcel(auth)) }
func GetCAs(store *liftca.Store, r *ht.Request) *ht.Answer { response := make([]JSONCAResponse, 0) for _, s := range store.GetCAs() { auth, _ := store.Get(s) if auth.Visible { response = append(response, *JSONCAResponseFromParcel(auth)) } } return ht.JSONDocument(response) }
func GetCerts(store *liftca.Store, r *ht.Request) *ht.Answer { ca, answer := ObtainCA(store, r) if answer != nil { return answer } children, _ := store.GetChildren(ca.SerialNumber()) response := make([]JSONCertResponse, 0) for _, s := range children { cert, _ := store.Get(s) response = append(response, *JSONCertResponseFromParcel(ca.SerialNumber(), cert)) } return ht.JSONDocument(response) }
func GetCRL(store *liftca.Store, r *ht.Request) *ht.Answer { ca, answer := ObtainCA(store, r) if answer != nil { return answer } revoked := store.GetRevokedChildren(ca.SerialNumber()) output := make([]string, len(revoked)) for i, e := range revoked { output[i] = strconv.FormatInt(e, 10) } return ht.JSONDocument(&JSONCRLResponse{ Self: CACRLURL(ca.SerialNumber()), SerialNumbers: output, }) }