Holds SignatureInfo and SignatureValue in a Data packet. More...
#include <signature.hpp>
Classes | |
class | Error |
Public Member Functions | |
Signature ()=default | |
Signature (const Block &info, const Block &value=Block()) | |
Signature (const SignatureInfo &info, const Block &value=Block()) | |
operator bool () const | |
Determine whether SignatureInfo is valid. More... | |
const SignatureInfo & | getSignatureInfo () const |
Get SignatureInfo. More... | |
const Block & | getInfo () const |
Get SignatureInfo as wire format. More... | |
void | setInfo (const Block &info) |
Decode SignatureInfo from wire format. More... | |
void | setInfo (const SignatureInfo &info) |
Set SignatureInfo. More... | |
const Block & | getValue () const |
Get SignatureValue. More... | |
void | setValue (const Block &value) |
Set SignatureValue. More... | |
tlv::SignatureTypeValue | getType () const |
Get SignatureType. More... | |
bool | hasKeyLocator () const |
Check if KeyLocator exists in SignatureInfo. More... | |
const KeyLocator & | getKeyLocator () const |
Get KeyLocator. More... | |
void | setKeyLocator (const KeyLocator &keyLocator) |
Set KeyLocator. More... | |
void | unsetKeyLocator () |
Unset KeyLocator. More... | |
Protected Attributes | |
SignatureInfo | m_info |
Block | m_value |
Holds SignatureInfo and SignatureValue in a Data packet.
A Signature is not a TLV element itself. It collects SignatureInfo and SignatureValue TLV elements together for easy access. In most cases, an application should use a subclass of Signature such as DigestSha256
, SignatureSha256WithRsa
, or SignatureSha256WithEcdsa
instead of using Signature
type directly.
Definition at line 37 of file signature.hpp.
|
default |
Definition at line 30 of file signature.cpp.
|
explicit |
Definition at line 37 of file signature.cpp.
|
inlineexplicit |
Determine whether SignatureInfo is valid.
Definition at line 57 of file signature.hpp.
References ndn::SignatureInfo::getSignatureType(), and m_info.
|
inline |
Get SignatureInfo.
Definition at line 65 of file signature.hpp.
References m_info.
Referenced by ndn::security::v2::Certificate::getExtension(), ndn::security::v2::getKeyLocatorName(), ndn::security::v2::Certificate::getValidityPeriod(), ndn::security::v2::Certificate::isValid(), ndn::security::v2::operator<<(), and ndn::operator==().
|
inline |
Get SignatureInfo as wire format.
Definition at line 73 of file signature.hpp.
References m_info, and ndn::SignatureInfo::wireEncode().
Referenced by ndn::Interest::matchesData(), and ndn::Data::wireEncode().
void ndn::Signature::setInfo | ( | const Block & | info | ) |
Decode SignatureInfo from wire format.
tlv::Error | decode error |
Definition at line 53 of file signature.cpp.
References m_info, and ndn::tlv::SignatureInfo.
Referenced by ndn::Data::wireDecode().
|
inline |
|
inline |
Get SignatureValue.
Definition at line 95 of file signature.hpp.
References m_value.
Referenced by ndn::operator<<(), ndn::operator==(), ndn::security::parse(), and ndn::Data::wireEncode().
void ndn::Signature::setValue | ( | const Block & | value | ) |
Set SignatureValue.
tlv::Error | TLV-TYPE of supplied block is not SignatureValue, or the block does not have TLV-VALUE |
Definition at line 59 of file signature.cpp.
References m_value, ndn::tlv::SignatureValue, ndn::to_string(), and ndn::Block::type().
Referenced by ndn::Data::setSignatureValue(), and ndn::Data::wireDecode().
tlv::SignatureTypeValue ndn::Signature::getType | ( | ) | const |
Get SignatureType.
Error | signature is invalid |
Definition at line 44 of file signature.cpp.
References ndn::SignatureInfo::getSignatureType(), and m_info.
Referenced by ndn::DigestSha256::DigestSha256(), ndn::security::v2::operator<<(), ndn::operator<<(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), and ndn::SignatureSha256WithRsa::SignatureSha256WithRsa().
|
inline |
Check if KeyLocator exists in SignatureInfo.
Definition at line 116 of file signature.hpp.
References ndn::SignatureInfo::hasKeyLocator(), and m_info.
Referenced by ndn::security::v2::operator<<(), ndn::SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(), and ndn::SignatureSha256WithRsa::SignatureSha256WithRsa().
|
inline |
Get KeyLocator.
tlv::Error | KeyLocator does not exist in SignatureInfo |
Definition at line 125 of file signature.hpp.
References ndn::SignatureInfo::getKeyLocator(), and m_info.
Referenced by ndn::security::v2::operator<<().
|
inline |
Set KeyLocator.
Definition at line 133 of file signature.hpp.
References m_info, and ndn::SignatureInfo::setKeyLocator().
|
inline |
Unset KeyLocator.
Definition at line 144 of file signature.hpp.
References m_info, and ndn::SignatureInfo::unsetKeyLocator().
|
protected |
Definition at line 150 of file signature.hpp.
Referenced by getInfo(), getKeyLocator(), getSignatureInfo(), getType(), hasKeyLocator(), operator bool(), setInfo(), setKeyLocator(), and unsetKeyLocator().
|
mutableprotected |
Definition at line 151 of file signature.hpp.
Referenced by getValue(), and setValue().