security: CryptoPP functions are used directly to encode/decode DER/BER
This change eliminates the need for custom der decoder/encoder.
Change-Id: I5be2e55cec2b63157927a4ad87fffe8e8651ed3c
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
index 30af6bf..9576e0d 100644
--- a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
@@ -12,42 +12,46 @@
#include "../../common.hpp"
#include "../../encoding/oid.hpp"
+namespace CryptoPP { class BufferedTransformation; }
+
namespace ndn {
-namespace der { class DerNode; }
-
/**
* A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate.
*/
class CertificateSubjectDescription {
public:
- /**
- * Create a new CertificateSubjectDescription.
- * @param oid The oid of the subject description entry.
- * @param value The value of the subject description entry.
- */
- CertificateSubjectDescription(std::string oid, std::string value)
- : oid_(oid), value_(value)
+ CertificateSubjectDescription(CryptoPP::BufferedTransformation &in)
{
- }
-
- /**
- * Create a new CertificateSubjectDescription.
- * @param oid The oid of the subject description entry.
- * @param value The value of the subject description entry.
- */
- CertificateSubjectDescription(OID oid, std::string value)
- : oid_(oid), value_(value)
- {
+ decode(in);
}
/**
- * Encode the object into a DER syntax tree.
- * @return The encoded DER syntax tree.
+ * Create a new CertificateSubjectDescription.
+ * @param oid The oid of the subject description entry.
+ * @param value The value of the subject description entry.
*/
- ptr_lib::shared_ptr<der::DerNode>
- toDer() const;
+ 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)
+ {
+ }
+
+ void
+ encode(CryptoPP::BufferedTransformation &out) const;
+
+ void
+ decode(CryptoPP::BufferedTransformation &in);
+
std::string
getOidString() const
{