DER encoding: implement Certificate::printCertificate().
diff --git a/ndn-cpp/encoding/der/visitor/certificate-data-visitor.cpp b/ndn-cpp/encoding/der/visitor/certificate-data-visitor.cpp
index e2ea049..bddf20c 100644
--- a/ndn-cpp/encoding/der/visitor/certificate-data-visitor.cpp
+++ b/ndn-cpp/encoding/der/visitor/certificate-data-visitor.cpp
@@ -35,9 +35,9 @@
// _LOG_DEBUG("CertificateDataVisitor::visit");
const DerNodePtrList& children = derSeq.getChildren();
- CertValidityVisitor validityVisitor;
+ CertificateValidityVisitor validityVisitor;
children[0]->accept(validityVisitor, param);
- CertSubjectVisitor subjectVisitor;
+ CertificateSubjectVisitor subjectVisitor;
children[1]->accept(subjectVisitor, param);
PublicKeyVisitor pubkeyVisitor;
Certificate* certData = ndnboost::any_cast<Certificate*>(param);
@@ -45,7 +45,7 @@
if(children.size() > 3)
{
- CertExtensionVisitor extnVisitor;
+ CertificateExtensionVisitor extnVisitor;
children[3]->accept(extnVisitor, param);
}
}
@@ -54,7 +54,7 @@
* CertValidityVisitor
*/
void
-CertValidityVisitor::visit(DerSequence& derSeq, ndnboost::any param)
+CertificateValidityVisitor::visit(DerSequence& derSeq, ndnboost::any param)
{
// _LOG_DEBUG("CertValidityVisitor::visit");
@@ -78,7 +78,7 @@
* CertSubDescryptVisitor
*/
void
-CertSubDescryptVisitor::visit(DerSequence& derSeq, ndnboost::any param)
+CertificateSubjectDescriptionVisitor::visit(DerSequence& derSeq, ndnboost::any param)
{
Certificate* certData = ndnboost::any_cast<Certificate*>(param);
@@ -98,13 +98,13 @@
* CertSubjectVisitor
*/
void
-CertSubjectVisitor::visit(DerSequence& derSeq, ndnboost::any param)
+CertificateSubjectVisitor::visit(DerSequence& derSeq, ndnboost::any param)
{
// _LOG_DEBUG("CertSubjectVisitor::visit");
const DerNodePtrList& children = derSeq.getChildren();
- CertSubDescryptVisitor descryptVisitor;
+ CertificateSubjectDescriptionVisitor descryptVisitor;
DerNodePtrList::const_iterator it = children.begin();
@@ -118,7 +118,7 @@
* CertExtnEntryVisitor
*/
void
-CertExtnEntryVisitor::visit(DerSequence& derSeq, ndnboost::any param)
+CertificateExtensionEntryVisitor::visit(DerSequence& derSeq, ndnboost::any param)
{
Certificate* certData = ndnboost::any_cast<Certificate*>(param);
@@ -139,11 +139,11 @@
* CertExtensionVisitor
*/
void
-CertExtensionVisitor::visit(DerSequence& derSeq, ndnboost::any param)
+CertificateExtensionVisitor::visit(DerSequence& derSeq, ndnboost::any param)
{
const DerNodePtrList& children = derSeq.getChildren();
- CertExtnEntryVisitor extnEntryVisitor;
+ CertificateExtensionEntryVisitor extnEntryVisitor;
DerNodePtrList::const_iterator it = children.begin();
diff --git a/ndn-cpp/encoding/der/visitor/certificate-data-visitor.hpp b/ndn-cpp/encoding/der/visitor/certificate-data-visitor.hpp
index 3df60be..ec73bd7 100644
--- a/ndn-cpp/encoding/der/visitor/certificate-data-visitor.hpp
+++ b/ndn-cpp/encoding/der/visitor/certificate-data-visitor.hpp
@@ -19,27 +19,27 @@
virtual void visit(DerSequence&, ndnboost::any);
};
-class CertValidityVisitor : public VoidVisitor {
+class CertificateValidityVisitor : public VoidVisitor {
public:
virtual void visit(DerSequence&, ndnboost::any);
};
-class CertSubDescryptVisitor : public VoidVisitor {
+class CertificateSubjectDescriptionVisitor : public VoidVisitor {
public:
virtual void visit(DerSequence&, ndnboost::any);
};
-class CertSubjectVisitor : public VoidVisitor {
+class CertificateSubjectVisitor : public VoidVisitor {
public:
virtual void visit(DerSequence&, ndnboost::any);
};
-class CertExtnEntryVisitor : public VoidVisitor {
+class CertificateExtensionEntryVisitor : public VoidVisitor {
public:
virtual void visit(DerSequence&, ndnboost::any);
};
-class CertExtensionVisitor : public VoidVisitor {
+class CertificateExtensionVisitor : public VoidVisitor {
public:
virtual void visit(DerSequence&, ndnboost::any);
};
diff --git a/ndn-cpp/security/certificate/certificate.cpp b/ndn-cpp/security/certificate/certificate.cpp
index 90010b3..8f6288c 100644
--- a/ndn-cpp/security/certificate/certificate.cpp
+++ b/ndn-cpp/security/certificate/certificate.cpp
@@ -13,9 +13,7 @@
#include <ndn-cpp/sha256-with-rsa-signature.hpp>
#include "../../encoding/der/der.hpp"
#include "../../encoding/der/visitor/certificate-data-visitor.hpp"
-#if 0
#include "../../encoding/der/visitor/print-visitor.hpp"
-#endif
#include "../../util/logging.hpp"
#include "../../util/blob-stream.hpp"
#include "../../c/util/time.h"
@@ -124,7 +122,6 @@
node->accept(certDataVisitor, this);
}
-#if 0
void
Certificate::printCertificate()
{
@@ -133,19 +130,17 @@
cout << notAfter_ << endl;
cout << "Subject Info:" << endl;
- vector<CertificateSubDescrypt>::iterator it = m_subjectList.begin();
- for(; it < m_subjectList.end(); it++){
- cout << it->getOidStr() << "\t" << it->getValue() << endl;
+ vector<CertificateSubjectDescription>::iterator it = subjectDescriptionList_.begin();
+ for(; it < subjectDescriptionList_.end(); it++){
+ cout << it->getOidString() << "\t" << it->getValue() << endl;
}
- boost::iostreams::stream
- <boost::iostreams::array_source> is(key_.getKeyBlob().buf (), m_key.getKeyBlob().size ());
+ ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)key_.getKeyDer().buf(), key_.getKeyDer().size());
- shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<InputIterator&> (is));
+ shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
der::PrintVisitor printVisitor;
keyRoot->accept(printVisitor, string(""));
}
-#endif
}