security: Fixing decoding/encoding certificates. Now the test is fully working
Change-Id: Ieaecba4576d1af3abc68e48baa87e8d4d312b702
diff --git a/include/ndn-cpp/encoding/oid.hpp b/include/ndn-cpp/encoding/oid.hpp
index f89339c..e755c05 100644
--- a/include/ndn-cpp/encoding/oid.hpp
+++ b/include/ndn-cpp/encoding/oid.hpp
@@ -22,6 +22,8 @@
{
}
+ OID(const char *oid);
+
OID(const std::string& oid);
OID(const std::vector<int>& oid)
@@ -58,10 +60,16 @@
void
decode(CryptoPP::BufferedTransformation &in);
-
-private:
- bool equal(const OID& oid) const;
+
+private:
+ void
+ construct(const std::string &value);
+
+ bool
+ equal(const OID& oid) const;
+
+private:
std::vector<int> oid_;
};
diff --git a/include/ndn-cpp/security/certificate/certificate-extension.hpp b/include/ndn-cpp/security/certificate/certificate-extension.hpp
index 697993c..d979d44 100644
--- a/include/ndn-cpp/security/certificate/certificate-extension.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-extension.hpp
@@ -27,17 +27,6 @@
{
decode(in);
}
-
- /**
- * Create a new CertificateExtension.
- * @param oid The oid of subject description entry.
- * @param isCritical If true, the extension must be handled.
- * @param value The extension value.
- */
- CertificateExtension(const std::string& oid, const bool isCritical, const Buffer& value)
- : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
- {
- }
/**
* Create a new CertificateExtension.
@@ -46,10 +35,15 @@
* @param value The extension value.
*/
CertificateExtension(const OID& oid, const bool isCritical, const Buffer& value)
- : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
+ : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
{
}
+ CertificateExtension(const OID& oid, const bool isCritical, const uint8_t* value, size_t valueSize)
+ : extensionId_(oid), isCritical_(isCritical), extensionValue_(value, valueSize)
+ {
+ }
+
/**
* The virtual destructor.
*/
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
index 9576e0d..5717920 100644
--- a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
@@ -31,16 +31,6 @@
* @param oid The oid of the subject description entry.
* @param value The value of the subject description entry.
*/
- CertificateSubjectDescription(const std::string &oid, const std::string &value)
- : oid_(oid), value_(value)
- {
- }
-
- /**
- * Create a new CertificateSubjectDescription.
- * @param oid The oid of the subject description entry.
- * @param value The value of the subject description entry.
- */
CertificateSubjectDescription(const OID &oid, const std::string &value)
: oid_(oid), value_(value)
{