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... | |
const SignatureInfo & | getSignatureInfo () const |
Get SignatureInfo. 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, and ndn::SignatureInfo::wireEncode().
Referenced by ndn::security::KeyChain::getDefaultKeyParamsForIdentity(), ndn::Interest::matchesData(), operator==(), ndn::security::KeyChain::selfSign(), ndn::security::KeyChain::signWithSha256(), and ndn::Data::wireEncode().
|
inline |
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 getSignatureInfo(), ndn::security::Validator::verifySignature(), and ndn::Data::wireDecode().
|
inline |
|
inline |
Get SignatureValue in the wire format.
Definition at line 105 of file signature.hpp.
References ndn::Block::encode(), m_value, and setValue().
Referenced by ndn::operator<<(), operator==(), ndn::security::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(), ndn::security::Validator::verifySignature(), and ndn::Data::wireDecode().
|
inline |
Get signature type.
Definition at line 123 of file signature.hpp.
References ndn::SignatureInfo::getSignatureType(), and m_info.
Referenced by ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::security::ValidatorConfig::checkPolicy(), ndn::DigestSha256::DigestSha256(), ndn::operator<<(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), ndn::SignatureSha256WithRsa::SignatureSha256WithRsa(), and ndn::security::Validator::verifySignature().
|
inline |
Check if SignatureInfo block has a KeyLocator.
Definition at line 132 of file signature.hpp.
References ndn::SignatureInfo::hasKeyLocator(), and m_info.
Referenced by ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::security::ValidatorRegex::checkPolicy(), ndn::security::ValidatorConfig::checkPolicy(), ndn::SecRuleSpecific::matchSignerName(), ndn::SecRuleRelative::matchSignerName(), ndn::SecRuleRelative::satisfy(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), ndn::SignatureSha256WithRsa::SignatureSha256WithRsa(), and ndn::security::Validator::verifySignature().
|
inline |
Get KeyLocator.
Signature::Error | if KeyLocator does not exist |
Definition at line 143 of file signature.hpp.
References ndn::SignatureInfo::getKeyLocator(), and m_info.
Referenced by ndn::security::SecPublicInfoSqlite3::addCertificate(), ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::security::ValidatorRegex::checkPolicy(), ndn::security::ValidatorConfig::checkPolicy(), ndn::SecRuleSpecific::matchSignerName(), ndn::SecRuleRelative::matchSignerName(), ndn::security::v1::Certificate::printCertificate(), and ndn::SecRuleRelative::satisfy().
|
inline |
Set KeyLocator.
Definition at line 152 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 164 of file signature.hpp.
References m_info, and ndn::SignatureInfo::unsetKeyLocator().
|
inline |
Definition at line 171 of file signature.hpp.
References getInfo(), and getValue().
|
inline |
Definition at line 178 of file signature.hpp.
|
protected |
Definition at line 184 of file signature.hpp.
Referenced by getInfo(), getKeyLocator(), getSignatureInfo(), getType(), hasKeyLocator(), operator bool(), setInfo(), setKeyLocator(), and unsetKeyLocator().
|
mutableprotected |
Definition at line 185 of file signature.hpp.
Referenced by getValue(), and setValue().