20 #ifndef NDN_NAC_COMMON_HPP
21 #define NDN_NAC_COMMON_HPP
23 #include "detail/config.hpp"
26 #define NAC_VIRTUAL_WITH_TESTS virtual
27 #define NAC_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
28 #define NAC_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
29 #define NAC_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
31 #define NAC_VIRTUAL_WITH_TESTS
32 #define NAC_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
33 #define NAC_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
34 #define NAC_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
40 #include <ndn-cxx/data.hpp>
41 #include <ndn-cxx/encoding/buffer-stream.hpp>
42 #include <ndn-cxx/face.hpp>
43 #include <ndn-cxx/ims/in-memory-storage-persistent.hpp>
44 #include <ndn-cxx/interest.hpp>
45 #include <ndn-cxx/security/certificate.hpp>
46 #include <ndn-cxx/security/key-chain.hpp>
47 #include <ndn-cxx/security/signing-info.hpp>
48 #include <ndn-cxx/security/transform/public-key.hpp>
49 #include <ndn-cxx/security/validation-callback.hpp>
50 #include <ndn-cxx/security/validation-error.hpp>
51 #include <ndn-cxx/security/validator.hpp>
53 #include <boost/assert.hpp>
57 using security::Certificate;
58 using security::DataValidationFailureCallback;
59 using security::DataValidationSuccessCallback;
60 using security::Identity;
62 using security::SafeBag;
63 using security::SigningInfo;
64 using security::ValidationError;
65 using security::Validator;
66 using security::extractKeyNameFromCertName;
67 using security::transform::PublicKey;
71 using namespace ndn::tlv;
83 inline const name::Component
NAC{
"NAC"};
84 inline const name::Component
KEK{
"KEK"};
85 inline const name::Component
KDK{
"KDK"};
86 inline const name::Component
CK{
"CK"};
119 class Error :
public std::runtime_error
122 using std::runtime_error::runtime_error;
139 std::tuple<Name, Name, Name>
const name::Component KDK
@ MissingRequiredKeyLocator
std::tuple< Name, Name, Name > extractKdkInfoFromCkName(const Name &ckDataName, const Name &ckName, const ErrorCallback &onFailure)
Extract KDK information from name of CK data packet name.
constexpr time::seconds DEFAULT_KEK_FRESHNESS_PERIOD
Name convertKekNameToKdkPrefix(const Name &kekName, const ErrorCallback &onFailure)
Convert KEK name to KDK prefix:
constexpr time::seconds DEFAULT_CK_FRESHNESS_PERIOD
constexpr time::seconds DEFAULT_KDK_FRESHNESS_PERIOD
std::function< void(const ErrorCode &, const std::string &)> ErrorCallback
constexpr size_t AES_IV_SIZE
const name::Component ENCRYPTED_BY
const name::Component KEK
constexpr time::seconds RETRY_DELAY_KEK_RETRIEVAL
constexpr size_t AES_KEY_SIZE
const name::Component NAC
constexpr time::seconds RETRY_DELAY_AFTER_NACK