Index: tokenserver/appengine/impl/certconfig/ca.go |
diff --git a/tokenserver/appengine/impl/certconfig/ca.go b/tokenserver/appengine/impl/certconfig/ca.go |
index 04f7c7884837c07de0ed5b07e0cf53b37ab47c64..f2c1684afad13dd2ac7fdb270b6aa163a200418a 100644 |
--- a/tokenserver/appengine/impl/certconfig/ca.go |
+++ b/tokenserver/appengine/impl/certconfig/ca.go |
@@ -71,6 +71,20 @@ func (c *CA) ParseConfig() (*admin.CertificateAuthorityConfig, error) { |
return msg, nil |
} |
+// ListCAs returns names of all currently active CAs, in no particular order. |
+func ListCAs(c context.Context) ([]string, error) { |
+ keys := []*ds.Key{} |
+ q := ds.NewQuery("CA").Eq("Removed", false).KeysOnly(true) |
+ if err := ds.GetAll(c, q, &keys); err != nil { |
+ return nil, errors.WrapTransient(err) |
+ } |
+ names := make([]string, len(keys)) |
+ for i, key := range keys { |
+ names[i] = key.StringID() |
+ } |
+ return names, nil |
+} |
+ |
// CAUniqueIDToCNMap is a singleton entity that stores a mapping between CA's |
// unique_id (specified in config) and its Common Name. |
// |