ndn::security::v2::DataValidationState Class Referencefinal

Validation state for a data packet. More...

#include <ndn-cxx/security/v2/validation-state.hpp>

+ Inheritance diagram for ndn::security::v2::DataValidationState:
+ Collaboration diagram for ndn::security::v2::DataValidationState:

Public Member Functions

 DataValidationState (const Data &data, const DataValidationSuccessCallback &successCb, const DataValidationFailureCallback &failureCb)
 Create validation state for data. More...
 
 ~DataValidationState () final
 Destructor. More...
 
void addCertificate (const Certificate &cert)
 Add cert to the top of the certificate chain. More...
 
void fail (const ValidationError &error) final
 Call the failure callback. More...
 
size_t getDepth () const
 
const DatagetOriginalData () const
 
boost::logic::tribool getOutcome () const
 
template<typename T >
shared_ptr< T > getTag () const
 get a tag item More...
 
bool hasSeenCertificateName (const Name &certName)
 Check if certName has been previously seen and record the supplied name. More...
 
template<typename T >
void removeTag () const
 remove tag item More...
 
template<typename T >
void setTag (shared_ptr< T > tag) const
 set a tag item More...
 

Protected Attributes

boost::logic::tribool m_outcome
 

Detailed Description

Validation state for a data packet.

Definition at line 158 of file validation-state.hpp.

Constructor & Destructor Documentation

ndn::security::v2::DataValidationState::DataValidationState ( const Data data,
const DataValidationSuccessCallback successCb,
const DataValidationFailureCallback failureCb 
)

Create validation state for data.

The caller must ensure that state instance is valid until validation finishes (i.e., until after validateCertificateChain() and validateOriginalPacket() are called)

Definition at line 88 of file validation-state.cpp.

ndn::security::v2::DataValidationState::~DataValidationState ( )
final

Destructor.

If neither success callback nor failure callback was called, the destructor will call failure callback with IMPLEMENTATION_ERROR error code.

Definition at line 99 of file validation-state.cpp.

Member Function Documentation

void ndn::security::v2::ValidationState::addCertificate ( const Certificate cert)
inherited

Add cert to the top of the certificate chain.

If m_certificateChain is empty, cert should be the signer of the original packet. If m_certificateChain is not empty, cert should be the signer of m_certificateChain.front().

Postcondition
m_certificateChain.front() == cert
Note
This function does not verify the signature bits.

Definition at line 60 of file validation-state.cpp.

void ndn::security::v2::DataValidationState::fail ( const ValidationError error)
finalvirtual

Call the failure callback.

Implements ndn::security::v2::ValidationState.

Definition at line 132 of file validation-state.cpp.

size_t ndn::security::v2::ValidationState::getDepth ( ) const
inherited
Returns
Depth of certificate chain

Definition at line 48 of file validation-state.cpp.

const Data & ndn::security::v2::DataValidationState::getOriginalData ( ) const
Returns
Original data being validated

Definition at line 141 of file validation-state.cpp.

boost::logic::tribool ndn::security::v2::ValidationState::getOutcome ( ) const
inlineinherited

Definition at line 70 of file validation-state.hpp.

template<typename T >
shared_ptr< T > ndn::TagHost::getTag ( ) const
inherited

get a tag item

Template Parameters
Ttype of the tag, which must be a subclass of ndn::Tag
Return values
nullptrif no Tag of type T is stored

Definition at line 66 of file tag-host.hpp.

bool ndn::security::v2::ValidationState::hasSeenCertificateName ( const Name certName)
inherited

Check if certName has been previously seen and record the supplied name.

Definition at line 54 of file validation-state.cpp.

template<typename T >
void ndn::TagHost::removeTag ( ) const
inherited

remove tag item

Note
Tag can be removed even on a const tag host instance

Definition at line 93 of file tag-host.hpp.

template<typename T >
void ndn::TagHost::setTag ( shared_ptr< T >  tag) const
inherited

set a tag item

Template Parameters
Ttype of the tag, which must be a subclass of ndn::Tag
Note
Tag can be set even on a const tag host instance

Definition at line 79 of file tag-host.hpp.

Member Data Documentation

boost::logic::tribool ndn::security::v2::ValidationState::m_outcome
protectedinherited

Definition at line 139 of file validation-state.hpp.