34 BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
35 BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
36 static_assert(std::is_base_of<Data::Error, Certificate::Error>::value,
37 "Certificate::Error must inherit from Data::Error");
56 :
Data(std::move(data))
59 NDN_THROW(
Error(
"Certificate name does not follow the naming conventions"));
136 os <<
"Certificate Name:\n"
137 <<
" " << cert.
getName() <<
"\n";
141 os <<
"Additional Description:\n";
144 for (
const auto& item : additionalDesc) {
145 os <<
" " << item.first <<
": " << item.second <<
"\n";
149 using namespace transform;
155 os <<
"Public Key:\n";
157 using namespace transform;
163 os << key.getKeySize() <<
"-bit " << key.getKeyType();
165 catch (
const std::runtime_error&) {
166 os <<
"Unknown (" << cert.
getPublicKey().size() <<
" bytes)";
186 os <<
"Signature Information:\n"
191 os <<
" Key Locator: " << *keyLoc <<
"\n";
193 os <<
" Self-Signed: yes\n";
204 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` "
205 "does not respect the naming conventions"));
215 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` "
216 "does not respect the naming conventions"));
Represents a TLV element of the NDN packet format.
Represents a Data packet.
int32_t getSignatureType() const noexcept
Get the SignatureType.
optional< KeyLocator > getKeyLocator() const noexcept
Get the KeyLocator element.
Data & setFreshnessPeriod(time::milliseconds freshnessPeriod)
const SignatureInfo & getSignatureInfo() const noexcept
Get the SignatureInfo element.
const Name & getName() const noexcept
Get the data name.
time::milliseconds getFreshnessPeriod() const
uint32_t getContentType() const
Data & setContentType(uint32_t type)
Represents an absolute name.
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
size_t size() const noexcept
Returns the number of components.
const Component & at(ssize_t i) const
Returns an immutable reference to the component at the specified index, with bounds checking.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
security::ValidityPeriod getValidityPeriod() const
Get the ValidityPeriod element.
optional< Block > getCustomTlv(uint32_t type) const
Get first custom TLV element with the specified TLV-TYPE.
Represents a name component.
Represents a ValidityPeriod TLV element.
bool isValid(const time::system_clock::TimePoint &now=time::system_clock::now()) const
Check if now falls within the validity period.
std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > getPeriod() const
Get the stored validity period.
Represents an AdditionalDescription TLV element.
Represents an NDN certificate.
bool isValid(const time::system_clock::TimePoint &ts=time::system_clock::now()) const
Check if the certificate is valid at ts.
name::Component getIssuerId() const
Get issuer ID.
static const name::Component KEY_COMPONENT
Name getKeyName() const
Get key name.
static const name::Component DEFAULT_ISSUER_ID
Name getIdentity() const
Get identity name.
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
static const ssize_t KEY_COMPONENT_OFFSET
static const size_t MIN_KEY_NAME_LENGTH
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
name::Component getKeyId() const
Get key ID.
static const size_t MIN_CERT_NAME_LENGTH
static const ssize_t ISSUER_ID_OFFSET
span< const uint8_t > getPublicKey() const noexcept
Return the public key as a DER-encoded SubjectPublicKeyInfo structure, i.e., exactly as it appears in...
static const ssize_t VERSION_OFFSET
static const ssize_t KEY_ID_OFFSET
Block getExtension(uint32_t type) const
Get extension with TLV type.
Represents an error in TLV encoding or decoding.
Output to stream with specified indent or prefix.
std::string to_string(const errinfo_stacktrace &x)
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &desc)
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
Name extractIdentityFromCertName(const Name &certName)
Extract identity namespace from the certificate name certName.
std::string toIsoExtendedString(const system_clock::time_point &timePoint)
Convert to the ISO 8601 string representation, extended format (YYYY-MM-DDTHH:MM:SS,...
@ ContentType_Key
public key, certificate
SignatureTypeValue
SignatureType values.