15 #include "../util/logging.hpp"
23 SecRuleRelative::SecRuleRelative (
const string& dataRegex,
const string& signerRegex,
25 const string& dataExpand,
const string& signerExpand,
28 m_dataRegex(dataRegex),
29 m_signerRegex(signerRegex),
31 m_dataExpand(dataExpand),
32 m_signerExpand(signerExpand),
33 m_dataNameRegex(dataRegex, dataExpand),
34 m_signerNameRegex(signerRegex, signerExpand)
36 if (op !=
">" && op !=
">=" && op !=
"==")
37 throw Error(
"op is wrong!");
51 Name signerName = sig.getKeyLocator().getName ();
52 return satisfy (dataName, signerName);
54 catch (std::runtime_error& e)
63 if (!m_dataNameRegex.
match(dataName))
65 Name expandDataName = m_dataNameRegex.
expand();
67 if (!m_signerNameRegex.
match(signerName))
69 Name expandSignerName = m_signerNameRegex.
expand();
71 bool matched = compare(expandDataName, expandSignerName);
88 Name signerName = sig.getKeyLocator().getName ();
89 return m_signerNameRegex.
match(signerName);
91 catch (std::runtime_error& e)
98 SecRuleRelative::compare(
const Name& dataName,
const Name& signerName)
100 if ((dataName == signerName) && (
"==" == m_op ||
">=" == m_op))
106 for (; i != dataName.
end () && j != signerName.
end (); i++, j++)
114 if (i == dataName.
end())
Representing of SHA256-with-RSA signature in a data packet.
const_iterator begin() const
Begin iterator (const).
int compare(const Component &other) const
Compare this to the other Component using NDN canonical ordering.
const Name & getName() const
virtual bool matchSignerName(const Data &data)
const_iterator end() const
End iterator (const).
virtual ~SecRuleRelative()
A Name holds an array of Name::Component and represents an NDN name.
#define INIT_LOGGER(name)
Copyright (C) 2013 Regents of the University of California.
virtual bool matchDataName(const Data &data)
const Signature & getSignature() const
virtual Name expand(const std::string &expand="")
virtual bool satisfy(const Data &data)
Component holds a read-only name component value.
bool match(const Name &name)