diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index d858e04..05220f5 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -25,11 +25,29 @@
 #include "../helper/ccnx-encoding-helper.h"
 #include "../helper/ccnx-decoding-helper.h"
 
+#include "../helper/ccnb-parser/ccnb-parser-common.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h"
+
+#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-block.h"
+#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h"
+
+#include <boost/foreach.hpp>
+
 NS_LOG_COMPONENT_DEFINE ("CcnxContentObjectHeader");
 
+using namespace ns3::CcnbParser;
+
 namespace ns3
 {
 
+const std::string CcnxContentObjectHeader::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
+
 NS_OBJECT_ENSURE_REGISTERED (CcnxContentObjectHeader);
 NS_OBJECT_ENSURE_REGISTERED (CcnxContentObjectTail);
 
@@ -61,48 +79,324 @@
   return *m_name;
 }
 
-void
-CcnxContentObjectHeader::SetTimestamp (const Time &timestamp)
-{
-  m_signedInfo.m_timestamp = timestamp;
-}
+#define CCNB CcnxEncodingHelper // just to simplify writing
 
-Time
-CcnxContentObjectHeader::GetTimestamp () const
-{
-  return m_signedInfo.m_timestamp;
-}
-
-void
-CcnxContentObjectHeader::SetFreshness (const Time &freshness)
-{
-  m_signedInfo.m_freshness = freshness;
-}
-
-Time
-CcnxContentObjectHeader::GetFreshness () const
-{
-  return m_signedInfo.m_freshness;
-}
-
-
-uint32_t
-CcnxContentObjectHeader::GetSerializedSize (void) const
-{
-  // unfortunately, we don't know exact header size in advance
-  return CcnxEncodingHelper::GetSerializedSize (*this);
-}
-    
 void
 CcnxContentObjectHeader::Serialize (Buffer::Iterator start) const
 {
-  CcnxEncodingHelper::Serialize (start, *this);
+  size_t written = 0;
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CcnbParser::CCN_DTAG); // <ContentObject>
+
+  // fake signature
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Signature, CcnbParser::CCN_DTAG); // <Signature>
+  // Signature ::= √DigestAlgorithm? 
+  //               Witness?         
+  //               √SignatureBits
+  if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+    {
+      written += CCNB::AppendString (start, CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+    }
+  written += CCNB::AppendTaggedBlob (start, CCN_DTAG_SignatureBits, GetSignature ().GetSignatureBits ()); // <SignatureBits />
+  written += CCNB::AppendCloser (start);                                    // </Signature>  
+
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG);    // <Name>
+  written += CCNB::AppendNameComponents (start, GetName()); //   <Component>...</Component>...
+  written += CCNB::AppendCloser (start);                                  // </Name>  
+
+  // fake signature
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_SignedInfo, CCN_DTAG); // <SignedInfo>
+  // SignedInfo ::= √PublisherPublicKeyDigest
+  //                √Timestamp
+  //                √Type?
+  //                √FreshnessSeconds?
+  //                FinalBlockID?
+  //                KeyLocator?
+  written += CCNB::AppendTaggedBlob (start, CCN_DTAG_PublisherPublicKeyDigest,         // <PublisherPublicKeyDigest>...
+                                     GetSignedInfo ().GetPublisherPublicKeyDigest ());
+  
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Timestamp, CCN_DTAG);            // <Timestamp>...
+  written += CCNB::AppendTimestampBlob (start, GetSignedInfo ().GetTimestamp ());
+  written += CCNB::AppendCloser (start);
+
+  if (GetSignedInfo ().GetContentType () != DATA)
+    {
+      uint8_t type[3];
+      type[0] = (GetSignedInfo ().GetContentType () >> 16) & 0xFF;
+      type[1] = (GetSignedInfo ().GetContentType () >> 8 ) & 0xFF;
+      type[2] = (GetSignedInfo ().GetContentType ()      ) & 0xFF;
+      
+      written += CCNB::AppendTaggedBlob (start, CCN_DTAG_Type, type, 3);
+    }
+  if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+    {
+      written += CCNB::AppendBlockHeader (start, CCN_DTAG_FreshnessSeconds, CCN_DTAG);
+      written += CCNB::AppendNumber (start, GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
+      written += CCNB::AppendCloser (start);
+    }
+  if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+    {
+      written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyLocator, CCN_DTAG); // <KeyLocator>
+      {
+        written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyName, CCN_DTAG);    // <KeyName>
+        {
+          written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG);       // <Name>
+          written += CCNB::AppendNameComponents (start, GetName());                  //   <Component>...</Component>...
+          written += CCNB::AppendCloser (start);                                     // </Name>
+        }
+        written += CCNB::AppendCloser (start);                                     // </KeyName>
+      }
+      written += CCNB::AppendCloser (start);                                     // </KeyLocator>
+    }
+  
+  written += CCNB::AppendCloser (start);                                     // </SignedInfo>
+
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Content, CCN_DTAG); // <Content>
+
+  // there are no closing tags !!!
+  // The closing tag is handled by CcnxContentObjectTail
 }
 
 uint32_t
+CcnxContentObjectHeader::GetSerializedSize () const
+{
+  size_t written = 0;
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_ContentObject); // <ContentObject>
+
+  // fake signature
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Signature); // <Signature>
+  // Signature ::= DigestAlgorithm? 
+  //               Witness?         
+  //               SignatureBits   
+  if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+    {
+      written += CCNB::EstimateString (CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+    }
+  written += CCNB::EstimateTaggedBlob (CCN_DTAG_SignatureBits,
+                                       sizeof (GetSignature ().GetSignatureBits ()));      // <SignatureBits />
+  written += 1;                                    // </Signature>  
+
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Name);    // <Name>
+  written += CCNB::EstimateNameComponents (GetName()); //   <Component>...</Component>...
+  written += 1;                                  // </Name>  
+
+  // fake signature
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_SignedInfo); // <SignedInfo>
+  // SignedInfo ::= √PublisherPublicKeyDigest
+  //                √Timestamp
+  //                √Type?
+  //                √FreshnessSeconds?
+  //                FinalBlockID?
+  //                KeyLocator?
+  
+  written += CCNB::EstimateTaggedBlob (CCN_DTAG_PublisherPublicKeyDigest,                          // <PublisherPublicKeyDigest>...
+                                       sizeof (GetSignedInfo ().GetPublisherPublicKeyDigest ()));
+  
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Timestamp);                  // <Timestamp>...
+  written += CCNB::EstimateTimestampBlob (GetSignedInfo ().GetTimestamp ());
+  written += 1;
+
+  if (GetSignedInfo ().GetContentType () != DATA)
+    {
+      written += CCNB::EstimateTaggedBlob (CCN_DTAG_Type, 3);
+    }
+  if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+    {
+      written += CCNB::EstimateBlockHeader (CCN_DTAG_FreshnessSeconds);
+      written += CCNB::EstimateNumber (GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
+      written += 1;
+    }
+
+  if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+    {
+      written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyLocator); // <KeyLocator>
+      {
+        written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyName);    // <KeyName>
+        {
+          written += CCNB::EstimateBlockHeader (CCN_DTAG_Name);       // <Name>
+          written += CCNB::EstimateNameComponents (GetName());        //   <Component>...</Component>...
+          written += 1;                                               // </Name>
+        }
+        written += 1;                                               // </KeyName>
+      }
+      written += 1;                                               // </KeyLocator>
+    }
+  
+  written += 1; // </SignedInfo>
+
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Content); // <Content>
+
+  // there are no closing tags !!!
+  // The closing tag is handled by CcnxContentObjectTail
+  return written;
+}
+#undef CCNB
+
+class ContentObjectVisitor : public VoidDepthFirstVisitor
+{
+public:
+  virtual void visit (Dtag &n, boost::any param/*should be CcnxContentObjectHeader* */)
+  {
+    // uint32_t n.m_dtag;
+    // std::list<Ptr<Block> > n.m_nestedBlocks;
+    static NameComponentsVisitor nameComponentsVisitor;
+    static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
+    static TimestampVisitor          timestampVisitor;
+    static StringVisitor     stringVisitor;
+    static Uint32tBlobVisitor uint32tBlobVisitor;
+    static ContentTypeVisitor contentTypeVisitor;
+  
+    CcnxContentObjectHeader &contentObject = *(boost::any_cast<CcnxContentObjectHeader*> (param));
+  
+    switch (n.m_dtag)
+      {
+      case CCN_DTAG_ContentObject:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }
+        break;
+      case CCN_DTAG_Name:
+        {
+          // process name components
+          Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
+        
+          BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+            {
+              block->accept (nameComponentsVisitor, &(*name));
+            }
+          contentObject.SetName (name);
+          break;
+        }
+
+      case CCN_DTAG_Signature: 
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+
+      case CCN_DTAG_DigestAlgorithm:
+        NS_LOG_DEBUG ("DigestAlgorithm");
+        if (n.m_nestedTags.size ()!=1) // should be exactly one UDATA inside this tag
+          throw CcnbDecodingException ();
+        
+        contentObject.GetSignature ().SetDigestAlgorithm
+          (boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept
+                                         (stringVisitor)));
+        break;
+
+      case CCN_DTAG_SignatureBits:
+        NS_LOG_DEBUG ("SignatureBits");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignature ().SetSignatureBits
+          (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                      (uint32tBlobVisitor)));
+        break;
+
+      case CCN_DTAG_SignedInfo:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+      
+      case CCN_DTAG_PublisherPublicKeyDigest:
+        NS_LOG_DEBUG ("PublisherPublicKeyDigest");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetPublisherPublicKeyDigest
+          (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                      (uint32tBlobVisitor)));
+        break;
+
+      case CCN_DTAG_Timestamp:
+        NS_LOG_DEBUG ("Timestamp");
+        if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetTimestamp
+          (boost::any_cast<Time> ((*n.m_nestedTags.begin())->accept
+                                  (timestampVisitor)));
+        break;
+
+      case CCN_DTAG_Type:
+        NS_LOG_DEBUG ("Type");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetContentType
+          (static_cast<CcnxContentObjectHeader::ContentType>
+           (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                       (contentTypeVisitor))));
+        break;
+        
+      case CCN_DTAG_FreshnessSeconds:
+        NS_LOG_DEBUG ("FreshnessSeconds");
+      
+        if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+          throw CcnbDecodingException ();
+        
+        contentObject.GetSignedInfo ().SetFreshness
+          (Seconds
+           (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                       (nonNegativeIntegerVisitor))));
+        break;
+      
+      case CCN_DTAG_KeyLocator:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+
+      case CCN_DTAG_KeyName:
+        {
+          if (n.m_nestedTags.size ()!=1) // should be exactly one nested tag
+            throw CcnbDecodingException ();
+
+          Ptr<BaseTag> nameTag = DynamicCast<BaseTag>(n.m_nestedTags.front ());
+          if (nameTag == 0)
+            throw CcnbDecodingException ();
+
+          // process name components
+          Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
+        
+          BOOST_FOREACH (Ptr<Block> block, nameTag->m_nestedTags)
+            {
+              block->accept (nameComponentsVisitor, &(*name));
+            }
+          contentObject.GetSignedInfo ().SetKeyLocator (name);
+          break;
+        }
+
+      case CCN_DTAG_Content: // !!! HACK
+        // This hack was necessary for memory optimizations (i.e., content is virtual payload)
+        NS_ASSERT_MSG (n.m_nestedTags.size() == 0, "Parser should have stopped just after processing <Content> tag");
+        break;
+      
+      default: // ignore all other stuff
+        break;
+      }
+  }
+};
+
+uint32_t
 CcnxContentObjectHeader::Deserialize (Buffer::Iterator start)
 {
-  return CcnxDecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
+  static ContentObjectVisitor contentObjectVisitor;
+
+  Buffer::Iterator i = start;
+  Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+  root->accept (contentObjectVisitor, this);
+
+  return i.GetDistanceFrom (start);
 }
   
 TypeId
@@ -176,5 +470,79 @@
 
   return 2;
 }
-  
+
+///////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////
+
+CcnxContentObjectHeader::SignedInfo::SignedInfo ()
+  : m_publisherPublicKeyDigest (0)
+  // ,  m_timestamp
+  , m_type (DATA)
+  // , m_freshness
+  // , FinalBlockID
+  // , KeyLocator
+{
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
+{
+  m_publisherPublicKeyDigest = digest;
+}
+
+uint32_t
+CcnxContentObjectHeader::SignedInfo::GetPublisherPublicKeyDigest () const
+{
+  return m_publisherPublicKeyDigest;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetTimestamp (const Time &timestamp)
+{
+  m_timestamp = timestamp;
+}
+
+Time
+CcnxContentObjectHeader::SignedInfo::GetTimestamp () const
+{
+  return m_timestamp;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetContentType (CcnxContentObjectHeader::ContentType type)
+{
+  m_type = type;
+}
+
+CcnxContentObjectHeader::ContentType
+CcnxContentObjectHeader::SignedInfo::GetContentType () const
+{
+  return m_type;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetFreshness (const Time &freshness)
+{
+  m_freshness = freshness;
+}
+
+Time
+CcnxContentObjectHeader::SignedInfo::GetFreshness () const
+{
+  return m_freshness;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetKeyLocator (Ptr<const CcnxNameComponents> keyLocator)
+{
+  m_keyLocator = keyLocator;
+}
+
+Ptr<const CcnxNameComponents>
+CcnxContentObjectHeader::SignedInfo::GetKeyLocator () const
+{
+  return m_keyLocator;
+}
+
 } // namespace ns3
diff --git a/model/ccnx-content-object-header.h b/model/ccnx-content-object-header.h
index 26e8333..a7bad01 100644
--- a/model/ccnx-content-object-header.h
+++ b/model/ccnx-content-object-header.h
@@ -51,10 +51,158 @@
  * "<ContentObject><Signature>..</Signature><Name>...</Name><SignedInfo>...</SignedInfo><Content>"
  * 
  */
-  
 class CcnxContentObjectHeader : public SimpleRefCount<CcnxContentObjectHeader,Header>
 {
 public:
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  /**
+   * @brief Class representing Signature section of the content object
+   */
+  class Signature
+  {
+  public:
+    /**
+     * @brief Default constructor. Creates a fake-type signature
+     */
+    inline Signature ();
+
+    inline const std::string &
+    GetDigestAlgorithm () const;
+
+    inline void
+    SetDigestAlgorithm (const std::string &digestAlgorithm);
+
+    inline uint32_t
+    GetSignatureBits () const;
+
+    inline void
+    SetSignatureBits (uint32_t signatureBits);
+
+    static const std::string DefaultDigestAlgorithm; // = "2.16.840.1.101.3.4.2.1";
+    
+  private:
+    std::string m_digestAlgorithm; // if value is `2.16.840.1.101.3.4.2.1`, then SHA-256 (not supported)
+                                   // in NS-3 value `99.0` represents a fake digest
+    // Witness // not used in NS-3
+    uint32_t m_signatureBits; // in NS-3 a fake signature is a just 32-bits
+  };
+  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
+  enum ContentType
+    {
+      DATA = 0x0C04C0, // default value. If ContentObject is type of DATA, then ContentType tag will be omitted
+      ENCR = 0x10D091,
+      GONE = 0x18E344,
+      KEY  = 0x28463F,
+      LINK = 0x2C834A,
+      NACK = 0x34008A
+    };
+
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
+  /**
+   * @brief Class representing SignedInfo section of the content object
+   */
+  class SignedInfo
+  {
+  public:
+    /**
+     * @brief Default constructor
+     */
+    SignedInfo (); 
+    
+    /**
+     * @brief Set PublisherPublicKey digest
+     * @param digest a fake 32-bit digest is supported
+     */
+    void
+    SetPublisherPublicKeyDigest (uint32_t digest);
+
+    /**
+     * @brief Get PublisherPublicKey digest
+     */
+    uint32_t
+    GetPublisherPublicKeyDigest () const;
+
+    /**
+     * @brief Set content object timestamp
+     * @param timestamp timestamp
+     */
+    void
+    SetTimestamp (const Time &timestamp);
+
+    /**
+     * @brief Get timestamp of the content object
+     */
+    Time
+    GetTimestamp () const;
+
+    /**
+     * @brief Set ContentObject type
+     * @param type type of the content object
+     */
+    void
+    SetContentType (ContentType type);
+
+    /**
+     * @brief Get ContentObject type
+     */
+    ContentType
+    GetContentType () const;
+    
+    /**
+     * @brief Set freshness of the content object
+     * @param freshness Freshness, 0s means infinity
+     */
+    void
+    SetFreshness (const Time &freshness);
+
+    /**
+     * @brief Get freshness of the content object
+     */
+    Time
+    GetFreshness () const;
+
+    /**
+     * @brief Set key locator
+     * @param keyLocator name of the key
+     *
+     * Note that only <KeyName> option for the key locator is supported
+     */
+    void
+    SetKeyLocator (Ptr<const CcnxNameComponents> keyLocator);
+
+    /**
+     * @brief Get key locator
+     *
+     * Note that only <KeyName> option for the key locator is supported
+     */
+    Ptr<const CcnxNameComponents>
+    GetKeyLocator () const;
+    
+  private:
+    uint32_t m_publisherPublicKeyDigest; // fake publisher key digest
+    Time m_timestamp;
+    ContentType m_type;
+    Time m_freshness;
+    // FinalBlockID
+    Ptr<const CcnxNameComponents> m_keyLocator; // support only <KeyName> option for KeyLocator
+  };
+
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
   /**
    * Constructor
    *
@@ -63,33 +211,42 @@
   CcnxContentObjectHeader ();
 
   /**
-   * \brief Set interest name
+   * \brief Set content object name
    *
-   * Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") );
+   * Sets name of the content object. For example, SetName( CcnxNameComponents("prefix")("postfix") );
    **/
   void
   SetName (const Ptr<CcnxNameComponents> &name);
 
+  /**
+   * @brief Get name of the content object
+   */
   const CcnxNameComponents&
   GetName () const;
 
-  // void
-  // SetSignature ();
+  /**
+   * @brief Get editable reference to content object's Signature
+   */
+  inline Signature &
+  GetSignature ();
 
-  // ?
-  // GetSignature () const;
+  /**
+   * @brief Get read-only reference to content object's Signature
+   */
+  inline const Signature &
+  GetSignature () const;
 
-  void
-  SetTimestamp (const Time &timestamp);
+  /**
+   * @brief Get editable reference to content object's SignedInfo
+   */
+  inline SignedInfo &
+  GetSignedInfo ();
 
-  Time
-  GetTimestamp () const;
-  
-  void
-  SetFreshness (const Time &freshness);
-
-  Time
-  GetFreshness () const;
+  /**
+   * @brief Get read-only reference to content object's SignedInfo
+   */
+  inline const SignedInfo &
+  GetSignedInfo () const;
   
   //////////////////////////////////////////////////////////////////
   
@@ -99,19 +256,9 @@
   virtual uint32_t GetSerializedSize (void) const;
   virtual void Serialize (Buffer::Iterator start) const;
   virtual uint32_t Deserialize (Buffer::Iterator start);
-
-  struct SignedInfo
-  {
-    // PublisherPublicKeyDigest
-    Time m_timestamp;
-    // Type (ContentType)
-    Time m_freshness;
-    // FinalBlockID
-    // KeyLocator
-  };
   
 private:
-  // m_signature;
+  Signature  m_signature;
   Ptr<CcnxNameComponents> m_name;
   SignedInfo m_signedInfo;
 };
@@ -134,8 +281,64 @@
   virtual uint32_t Deserialize (Buffer::Iterator start);
 };
 
+
+CcnxContentObjectHeader::Signature::Signature ()
+  : m_digestAlgorithm ("99.0")
+  , m_signatureBits (0)
+{
+}
+
+const std::string &
+CcnxContentObjectHeader::Signature::GetDigestAlgorithm () const
+{
+  return m_digestAlgorithm;
+}
+
+void
+CcnxContentObjectHeader::Signature::SetDigestAlgorithm (const std::string &digestAlgorithm)
+{
+  m_digestAlgorithm = digestAlgorithm;
+}
+
+uint32_t
+CcnxContentObjectHeader::Signature::GetSignatureBits () const
+{
+  return m_signatureBits;
+}
+
+inline void
+CcnxContentObjectHeader::Signature::SetSignatureBits (uint32_t signature)
+{
+  m_signatureBits = signature;
+}
+
+
+CcnxContentObjectHeader::Signature &
+CcnxContentObjectHeader::GetSignature ()
+{
+  return m_signature;
+}
+
+const CcnxContentObjectHeader::Signature &
+CcnxContentObjectHeader::GetSignature () const
+{
+  return m_signature;
+}
+
+CcnxContentObjectHeader::SignedInfo &
+CcnxContentObjectHeader::GetSignedInfo ()
+{
+  return m_signedInfo;
+}
+
+const CcnxContentObjectHeader::SignedInfo &
+CcnxContentObjectHeader::GetSignedInfo () const
+{
+  return m_signedInfo;
+}
+
 class CcnxContentObjectHeaderException {};
-  
+
 } // namespace ns3
 
 #endif // _CCNX_CONTENT_OBJECT_HEADER_H_
