Public Member Functions | Static Public Member Functions | Friends | List of all members
ndn::SignatureLite Class Reference

A SignatureLite holds a signature type, a KeyLocatorLite, the signature bytes and other fields to represent the Signature block of a Data packet. More...

#include <signature-lite.hpp>

Inheritance diagram for ndn::SignatureLite:
ndn_Signature

Public Member Functions

 SignatureLite (ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents)
 Create a SignatureLite with values for none. More...
 
void clear ()
 Set the fields the values for none as in the constructor.
 
ndn_SignatureType getType () const
 
const BlobLitegetSignature () const
 
const BlobLitegetSignatureInfoEncoding () const
 Get the bytes of the entire signature info encoding (including the type code). More...
 
int getGenericTypeCode () const
 Get the type code of the generic signature. More...
 
const KeyLocatorLitegetKeyLocator () const
 
KeyLocatorLitegetKeyLocator ()
 
void setType (ndn_SignatureType type)
 
void setSignature (const BlobLite &signature)
 Set the signature bytes. More...
 
void setSignatureInfoEncoding (const BlobLite &signatureInfoEncoding, int genericTypeCode)
 Set the bytes of the entire signature info encoding (including the type code). More...
 
ndn_Error set (const SignatureLite &other)
 Set this signature to have the values from the other signature. More...
 

Static Public Member Functions

static SignatureLitedownCast (ndn_Signature &signature)
 Downcast the reference to the ndn_Signature struct to a SignatureLite. More...
 
static const SignatureLitedownCast (const ndn_Signature &signature)
 

Friends

class Tlv0_1_1WireFormatLite
 

Detailed Description

A SignatureLite holds a signature type, a KeyLocatorLite, the signature bytes and other fields to represent the Signature block of a Data packet.

This has the union of fields needed to represent specific types of signature such as Sha256WithRsaSignature and DigestSha256Signature.

Constructor & Destructor Documentation

ndn::SignatureLite::SignatureLite ( ndn_NameComponent keyNameComponents,
size_t  maxKeyNameComponents 
)

Create a SignatureLite with values for none.

Parameters
keyNameComponentsThe pre-allocated array of ndn_NameComponent for the keyLocatorLite. Instead of an array of NameLite::Component, this is an array of the underlying ndn_NameComponent struct so that it doesn't run the default constructor unnecessarily.
maxKeyNameComponentsThe number of elements in the allocated keyNameComponents array.

Member Function Documentation

static SignatureLite& ndn::SignatureLite::downCast ( ndn_Signature signature)
inlinestatic

Downcast the reference to the ndn_Signature struct to a SignatureLite.

Parameters
signatureA reference to the ndn_Signature struct.
Returns
The same reference as SignatureLite.
int ndn::SignatureLite::getGenericTypeCode ( ) const
inline

Get the type code of the generic signature.

When wire decode calls setSignatureInfoEncoding, it sets the type code. Note that the type code is ignored during wire encode, which simply uses getSignatureInfoEncoding() where the encoding already has the type code. This is only meaningful if getType() is ndn_SignatureType_Generic.

Returns
The type code, or -1 if not known.
const BlobLite& ndn::SignatureLite::getSignatureInfoEncoding ( ) const
inline

Get the bytes of the entire signature info encoding (including the type code).

This is only meaningful if getType() is ndn_SignatureType_Generic.

Returns
The encoding bytes. If not specified, the value isNull().
ndn_Error ndn::SignatureLite::set ( const SignatureLite other)

Set this signature to have the values from the other signature.

Parameters
otherThe other SignatureLite to get values from.
Returns
0 for success, or an error code if there is not enough room in this object's key locator keyName components array.
void ndn::SignatureLite::setSignature ( const BlobLite signature)
inline

Set the signature bytes.

Parameters
signatureThe signature bytes. This copies a pointer to the bytes, but does not copy the bytes.
void ndn::SignatureLite::setSignatureInfoEncoding ( const BlobLite signatureInfoEncoding,
int  genericTypeCode 
)
inline

Set the bytes of the entire signature info encoding (including the type code).

This is only meaningful if getType() is ndn_SignatureType_Generic.

Parameters
signatureInfoEncodingThe encoding bytes. This copies a pointer to the bytes, but does not copy the bytes.
genericTypeCode(optional) The type code of the signature type, or -1 if not known. (When a Generic signature is created by wire decoding, it sets the typeCode.)

The documentation for this class was generated from the following files: