138 return certName.
size() >= Certificate::MIN_CERT_NAME_LENGTH &&
145 os <<
"Certificate Name:\n" 146 <<
" " << cert.
getName() <<
"\n";
150 os <<
"Additional Description:\n";
153 for (
const auto& item : additionalDesc) {
154 os <<
" " << item.first <<
": " << item.second <<
"\n";
164 os <<
"Public Key:\n";
172 os << key.getKeySize() <<
"-bit " << key.getKeyType();
174 catch (
const std::runtime_error&) {
195 os <<
"Signature Information:\n" 200 os <<
" Key Locator: " << *keyLoc <<
"\n";
202 os <<
" Self-Signed: yes\n";
213 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 214 "does not respect the naming conventions"));
217 return certName.
getPrefix(Certificate::KEY_COMPONENT_OFFSET);
224 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 225 "does not respect the naming conventions"));
228 return certName.
getPrefix(Certificate::KEY_ID_OFFSET + 1);
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
Data & setContentType(uint32_t type)
Copyright (c) 2011-2015 Regents of the University of California.
static const ssize_t KEY_ID_OFFSET
Represents an NDN certificate following the version 2.0 format.
Buffer getPublicKey() const
Get public key bits (in PKCS#8 format)
name::Component getIssuerId() const
Get issuer ID.
static const size_t MIN_KEY_NAME_LENGTH
std::string to_string(const T &val)
Name getIdentity() const
Get identity name.
Represents an AdditionalDescription TLV element.
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
const_iterator value_begin() const noexcept
Get begin iterator of TLV-VALUE.
size_t value_size() const noexcept
Return the size of TLV-VALUE, i.e., the TLV-LENGTH.
Represents a TLV element of the NDN packet format.
optional< KeyLocator > getKeyLocator() const noexcept
Get KeyLocator.
bool isValid(const time::system_clock::TimePoint &now=time::system_clock::now()) const
Check if now falls within the validity period.
static const size_t MIN_CERT_NAME_LENGTH
optional< Block > getCustomTlv(uint32_t type) const
Get first custom TLV element with the specified TLV-TYPE.
const Component & at(ssize_t i) const
Returns an immutable reference to the component at the specified index, with bounds checking...
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &desc)
int32_t getSignatureType() const noexcept
Get SignatureType.
Represents a ValidityPeriod TLV element.
static const ssize_t KEY_COMPONENT_OFFSET
std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > getPeriod() const
Get the stored validity period.
static const ssize_t VERSION_OFFSET
std::string toIsoExtendedString(const system_clock::time_point &timePoint)
Convert to the ISO 8601 string representation, extended format (YYYY-MM-DDTHH:MM:SS,fffffffff).
Name getKeyName() const
Get key name.
const Name & getName() const noexcept
Get name.
Represents an absolute name.
SignatureTypeValue
SignatureType values.
size_t size() const
Returns the number of components.
Represents a name component.
name::Component getKeyId() const
Get key ID.
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
const Block & getContent() const noexcept
Get the Content element.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
static const name::Component KEY_COMPONENT
static const ssize_t ISSUER_ID_OFFSET
Block getExtension(uint32_t type) const
Get extension with TLV type.
const_iterator value_end() const noexcept
Get end iterator of TLV-VALUE.
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
a concept check for TLV abstraction with .wireEncode method
time::milliseconds getFreshnessPeriod() const
Represents a Data packet.
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
General-purpose automatically managed/resized buffer.
Output to stream with specified indent or prefix.
uint32_t getContentType() const
bool isValid(const time::system_clock::TimePoint &ts=time::system_clock::now()) const
Check if the certificate is valid at ts.
represents an error in TLV encoding or decoding
const SignatureInfo & getSignatureInfo() const noexcept
Get SignatureInfo.
security::ValidityPeriod getValidityPeriod() const
Get ValidityPeriod.
static const name::Component DEFAULT_ISSUER_ID
Name extractIdentityFromCertName(const Name &certName)
Extract identity namespace from the certificate name certName.