23 #ifndef NDN_CERTIFICATE_HPP
24 #define NDN_CERTIFICATE_HPP
26 #include "../../data.hpp"
27 #include "../../common.hpp"
28 #include "../../sha256-with-rsa-signature.hpp"
30 #include "certificate-subject-description.hpp"
31 #include "certificate-extension.hpp"
32 #include "public-key.hpp"
36 typedef std::vector<CertificateSubjectDescription> SubjectDescriptionList;
37 typedef std::vector<CertificateExtension> ExtensionList;
84 const SubjectDescriptionList&
85 getSubjectDescriptionList()
const {
return subjectDescriptionList_; }
87 SubjectDescriptionList&
88 getSubjectDescriptionList() {
return subjectDescriptionList_; }
98 getExtensionList()
const {
return extensionList_; }
101 getExtensionList() {
return extensionList_; }
107 getNotBefore() {
return notBefore_; }
110 getNotBefore()
const {
return notBefore_; }
116 getNotAfter() {
return notAfter_; }
119 getNotAfter()
const {
return notAfter_; }
122 setPublicKeyInfo(
const PublicKey& key) { key_ = key; }
125 getPublicKeyInfo() {
return key_; }
128 getPublicKeyInfo()
const {
return key_; }
156 return dynamic_cast<const Sha256WithRsaSignature *
>
157 (getSignature())->getValidityPeriod().isValid(time);
161 printCertificate(std::ostream& os)
const;
164 printCertificate()
const;
170 SubjectDescriptionList subjectDescriptionList_;
174 ExtensionList extensionList_;
177 ptr_lib::shared_ptr<DerNode>
Certificate()
The default constructor.
Definition: certificate.cpp:38
bool isTooEarly() const
Check if the certificate is valid.
Definition: certificate.cpp:65
void addSubjectDescription(const CertificateSubjectDescription &description)
Add a subject description.
Definition: certificate.hpp:82
A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate.
Definition: certificate-subject-description.hpp:36
bool isTooLate() const
Check if the certificate is valid.
Definition: certificate.cpp:75
void encode()
Encode the contents of the certificate in DER format and set the Content and MetaInfo fields...
Definition: certificate.cpp:85
A CertificateExtension represents the Extension entry in a certificate.
Definition: certificate-extension.hpp:37
const Blob & getPublicKeyDer() const
Get the public key DER encoding.
Definition: certificate.cpp:56
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
double MillisecondsSince1970
The calendar time represented as the number of milliseconds since 1/1/1970.
Definition: common.hpp:119
void addExtension(const CertificateExtension &extension)
Add a certificate extension.
Definition: certificate.hpp:95
virtual void wireDecode(const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Override to call the base class wireDecode then populate the certificate fields.
Definition: certificate.cpp:93
virtual ~Certificate()
The virtual destructor.
Definition: certificate.cpp:50
Definition: certificate.hpp:39