ndn::security::DataValidationState Class Referencefinal

Validation state for a data packet. More...

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

+ Inheritance diagram for ndn::security::DataValidationState:
+ Collaboration diagram for ndn::security::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 noexcept
 
const DatagetOriginalData () const
 
boost::logic::tribool getOutcome () const noexcept
 
template<typename T >
std::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 a tag item. More...
 
template<typename T >
void setTag (std::shared_ptr< T > tag) const
 Set (add or replace) a tag item. More...
 

Protected Attributes

boost::logic::tribool m_outcome {boost::logic::indeterminate}
 

Detailed Description

Validation state for a data packet.

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

Constructor & Destructor Documentation

◆ DataValidationState()

ndn::security::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 73 of file validation-state.cpp.

◆ ~DataValidationState()

ndn::security::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 84 of file validation-state.cpp.

Member Function Documentation

◆ addCertificate()

void ndn::security::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 47 of file validation-state.cpp.

◆ fail()

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

Call the failure callback.

Implements ndn::security::ValidationState.

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

◆ getDepth()

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

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

◆ getOriginalData()

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

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

◆ getOutcome()

boost::logic::tribool ndn::security::ValidationState::getOutcome ( ) const
inlinenoexceptinherited

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

◆ getTag()

template<typename T >
std::shared_ptr< T > ndn::TagHost::getTag
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 72 of file tag-host.hpp.

◆ hasSeenCertificateName()

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

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

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

◆ removeTag()

template<typename T >
void ndn::TagHost::removeTag
inherited

Remove a tag item.

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

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

◆ setTag()

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

Set (add or replace) 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 84 of file tag-host.hpp.

Member Data Documentation

◆ m_outcome

boost::logic::tribool ndn::security::ValidationState::m_outcome {boost::logic::indeterminate}
protectedinherited

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