A Signature is storage for the signature-related information (info and value) in a Data packet. More...
#include <signature.hpp>
Classes | |
class | Error |
Public Types | |
enum | { Sha256 = tlv::DigestSha256, Sha256WithRsa = tlv::SignatureSha256WithRsa, Sha256WithEcdsa = tlv::SignatureSha256WithEcdsa } |
Public Member Functions | |
Signature ()=default | |
Signature (const Block &info, const Block &value=Block()) | |
Signature (const SignatureInfo &info, const Block &value=Block()) | |
operator bool () const | |
const Block & | getInfo () const |
Get SignatureInfo in the wire format. More... | |
void | setInfo (const Block &info) |
Set SignatureInfo from a block. More... | |
void | setInfo (const SignatureInfo &info) |
Set SignatureInfo. More... | |
const Block & | getValue () const |
Get SignatureValue in the wire format. More... | |
void | setValue (const Block &value) |
Get SignatureValue from a block. More... | |
uint32_t | getType () const |
Get signature type. More... | |
bool | hasKeyLocator () const |
Check if SignatureInfo block has a KeyLocator. More... | |
const KeyLocator & | getKeyLocator () const |
Get KeyLocator. More... | |
void | setKeyLocator (const KeyLocator &keyLocator) |
Set KeyLocator. More... | |
void | unsetKeyLocator () |
Unset KeyLocator. More... | |
bool | operator== (const Signature &other) const |
bool | operator!= (const Signature &other) const |
Protected Attributes | |
SignatureInfo | m_info |
Block | m_value |
A Signature is storage for the signature-related information (info and value) in a Data packet.
Definition at line 33 of file signature.hpp.
anonymous enum |
Enumerator | |
---|---|
Sha256 | |
Sha256WithRsa | |
Sha256WithEcdsa |
Definition at line 47 of file signature.hpp.
|
default |
Definition at line 30 of file signature.cpp.
|
explicit |
Definition at line 37 of file signature.cpp.
|
inline |
Definition at line 61 of file signature.hpp.
References ndn::SignatureInfo::getSignatureType(), and m_info.
|
inline |
Get SignatureInfo in the wire format.
Definition at line 70 of file signature.hpp.
References m_info, setInfo(), and ndn::SignatureInfo::wireEncode().
Referenced by ndn::security::KeyChain::importIdentity(), ndn::Interest::matchesData(), operator==(), ndn::security::KeyChain::selfSign(), ndn::security::KeyChain::signWithSha256(), and ndn::Data::wireEncode().
void ndn::Signature::setInfo | ( | const Block & | info | ) |
Set SignatureInfo from a block.
tlv::Error | if supplied block is not formatted correctly |
Definition at line 44 of file signature.cpp.
References m_info, and ndn::tlv::SignatureInfo.
Referenced by getInfo(), and ndn::Data::wireDecode().
|
inline |
|
inline |
Get SignatureValue in the wire format.
Definition at line 96 of file signature.hpp.
References ndn::Block::encode(), m_value, and setValue().
Referenced by ndn::operator<<(), operator==(), ndn::security::KeyChain::signWithSha256(), ndn::Validator::verifySignature(), and ndn::Data::wireEncode().
void ndn::Signature::setValue | ( | const Block & | value | ) |
Get SignatureValue from a block.
tlv::Error | if supplied block has type different from SignatureValue |
Definition at line 50 of file signature.cpp.
References m_value, ndn::tlv::SignatureValue, and ndn::Block::type().
Referenced by getValue(), ndn::Data::setSignatureValue(), ndn::security::KeyChain::sign(), ndn::security::KeyChain::signByIdentity(), and ndn::Data::wireDecode().
|
inline |
Get signature type.
Definition at line 114 of file signature.hpp.
References ndn::SignatureInfo::getSignatureType(), and m_info.
Referenced by ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::ValidatorConfig::checkPolicy(), ndn::CommandInterestValidator::checkPolicy(), ndn::DigestSha256::DigestSha256(), ndn::operator<<(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), ndn::SignatureSha256WithRsa::SignatureSha256WithRsa(), and ndn::Validator::verifySignature().
|
inline |
Check if SignatureInfo block has a KeyLocator.
Definition at line 123 of file signature.hpp.
References ndn::SignatureInfo::hasKeyLocator(), and m_info.
Referenced by ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::ValidatorRegex::checkPolicy(), ndn::ValidatorConfig::checkPolicy(), ndn::SecRuleSpecific::matchSignerName(), ndn::SecRuleRelative::matchSignerName(), ndn::SecRuleRelative::satisfy(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), ndn::SignatureSha256WithRsa::SignatureSha256WithRsa(), and ndn::Validator::verifySignature().
|
inline |
Get KeyLocator.
Signature::Error | if KeyLocator does not exist |
Definition at line 134 of file signature.hpp.
References ndn::SignatureInfo::getKeyLocator(), and m_info.
Referenced by ndn::SecPublicInfoSqlite3::addCertificate(), ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::ValidatorRegex::checkPolicy(), ndn::ValidatorConfig::checkPolicy(), ndn::CommandInterestValidator::checkPolicy(), ndn::SecRuleSpecific::matchSignerName(), ndn::SecRuleRelative::matchSignerName(), ndn::Certificate::printCertificate(), and ndn::SecRuleRelative::satisfy().
|
inline |
Set KeyLocator.
Definition at line 143 of file signature.hpp.
References m_info, and ndn::SignatureInfo::setKeyLocator().
|
inline |
Unset KeyLocator.
Note that specific signature types may provide advisory (non-virtual) override to prevent unsetting KeyLocator if it is required by the specification.
Definition at line 155 of file signature.hpp.
References m_info, and ndn::SignatureInfo::unsetKeyLocator().
|
inline |
Definition at line 162 of file signature.hpp.
References getInfo(), and getValue().
|
inline |
Definition at line 169 of file signature.hpp.
|
protected |
Definition at line 175 of file signature.hpp.
Referenced by getInfo(), getKeyLocator(), getType(), hasKeyLocator(), operator bool(), setInfo(), setKeyLocator(), and unsetKeyLocator().
|
mutableprotected |
Definition at line 176 of file signature.hpp.
Referenced by getValue(), and setValue().