diff --git a/ndn-cpp/ContentObject.cpp b/ndn-cpp/ContentObject.cpp
new file mode 100644
index 0000000..e675e5a
--- /dev/null
+++ b/ndn-cpp/ContentObject.cpp
@@ -0,0 +1,88 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "common.hpp"
+#include "ContentObject.hpp"
+
+using namespace std;
+
+namespace ndn {
+
+void Signature::get(struct ndn_Signature &signatureStruct) const 
+{
+  signatureStruct.digestAlgorithmLength = digestAlgorithm_.size();
+  if (digestAlgorithm_.size() > 0)
+    signatureStruct.digestAlgorithm = (unsigned char *)&digestAlgorithm_[0];
+  else
+    signatureStruct.digestAlgorithm = 0;
+
+  signatureStruct.witnessLength = witness_.size();
+  if (witness_.size() > 0)
+    signatureStruct.witness = (unsigned char *)&witness_[0];
+  else
+    signatureStruct.witness = 0;
+
+  signatureStruct.signatureLength = signature_.size();
+  if (signature_.size() > 0)
+    signatureStruct.signature = (unsigned char *)&signature_[0];
+  else
+    signatureStruct.signature = 0;
+}
+
+void Signature::set(const struct ndn_Signature &signatureStruct)
+{
+  setVector(digestAlgorithm_, signatureStruct.digestAlgorithm, signatureStruct.digestAlgorithmLength);
+  setVector(witness_, signatureStruct.witness, signatureStruct.witnessLength);
+  setVector(signature_, signatureStruct.signature, signatureStruct.signatureLength);
+}
+
+void SignedInfo::get(struct ndn_SignedInfo &signedInfoStruct) const 
+{
+  publisherPublicKeyDigest_.get(signedInfoStruct.publisherPublicKeyDigest);
+  // TODO: Implement timestamp
+  signedInfoStruct.type = type_;
+  signedInfoStruct.freshnessSeconds = freshnessSeconds_;
+  
+  signedInfoStruct.finalBlockIDLength = finalBlockID_.size();
+  if (finalBlockID_.size() > 0)
+    signedInfoStruct.finalBlockID = (unsigned char *)&finalBlockID_[0];
+  else
+    signedInfoStruct.finalBlockID = 0;
+
+  keyLocator_.get(signedInfoStruct.keyLocator);
+}
+
+void SignedInfo::set(const struct ndn_SignedInfo &signedInfoStruct)
+{
+  publisherPublicKeyDigest_.set(signedInfoStruct.publisherPublicKeyDigest);
+  // TODO: Implement timestamp
+  type_ = signedInfoStruct.type;
+  freshnessSeconds_ = signedInfoStruct.freshnessSeconds;
+  setVector(finalBlockID_, signedInfoStruct.finalBlockID, signedInfoStruct.finalBlockIDLength);
+  keyLocator_.set(signedInfoStruct.keyLocator);
+}
+
+void ContentObject::get(struct ndn_ContentObject &contentObjectStruct) const 
+{
+  signature_.get(contentObjectStruct.signature);
+  name_.get(contentObjectStruct.name);
+  signedInfo_.get(contentObjectStruct.signedInfo);
+  
+  contentObjectStruct.contentLength = content_.size();
+  if (content_.size() > 0)
+    contentObjectStruct.content = (unsigned char *)&content_[0];
+  else
+    contentObjectStruct.content = 0;
+}
+
+void ContentObject::set(const struct ndn_ContentObject &contentObjectStruct)
+{
+  signature_.set(contentObjectStruct.signature);
+  name_.set(contentObjectStruct.name);
+  signedInfo_.set(contentObjectStruct.signedInfo);
+  setVector(content_, contentObjectStruct.content, contentObjectStruct.contentLength);
+}
+
+}
