示例#1
0
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))
}
示例#2
0
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))
}
示例#3
0
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)
}
示例#4
0
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)
}
示例#5
0
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,
	})
}