Updating ca storage interface to support listing function
Change-Id: Iab9d50d075a139a671d94824b97c78b741203354
Refs:#4048
diff --git a/src/ca-detail/ca-memory.cpp b/src/ca-detail/ca-memory.cpp
index 14a6f87..566e08c 100644
--- a/src/ca-detail/ca-memory.cpp
+++ b/src/ca-detail/ca-memory.cpp
@@ -80,6 +80,28 @@
}
}
+std::list<CertificateRequest>
+CaMemory::listAllRequests()
+{
+ std::list<CertificateRequest> result;
+ for (const auto& entry : m_requests) {
+ result.push_back(entry.second);
+ }
+ return result;
+}
+
+std::list<CertificateRequest>
+CaMemory::listAllRequests(const Name& caName)
+{
+ std::list<CertificateRequest> result;
+ for (const auto& entry : m_requests) {
+ if (entry.second.getCaName() == caName) {
+ result.push_back(entry.second);
+ }
+ }
+ return result;
+}
+
// certificate related
security::v2::Certificate
CaMemory::getCertificate(const std::string& certId)
@@ -122,5 +144,27 @@
}
}
+std::list<security::v2::Certificate>
+CaMemory::listAllIssuedCertificates()
+{
+ std::list<security::v2::Certificate> result;
+ for (const auto& entry : m_issuedCerts) {
+ result.push_back(entry.second);
+ }
+ return result;
+}
+
+std::list<security::v2::Certificate>
+CaMemory::listAllIssuedCertificates(const Name& caName)
+{
+ std::list<security::v2::Certificate> result;
+ for (const auto& entry : m_issuedCerts) {
+ if (entry.second.getSignature().getKeyLocator().getName().getPrefix(-2) == caName) {
+ result.push_back(entry.second);
+ }
+ }
+ return result;
+}
+
} // namespace ndncert
} // namespace ndn