#include <string>
#include <sstream>
#include <vector>
+#include <cassert>
#include <boost/lexical_cast.hpp>
<< salt.size() << " bytes");
}
+ // Next hash must not be a padded base32hex string.
+ assert(!nexthash.empty());
+ if (*nexthash.rbegin() == '=') {
+ isc_throw(InvalidRdataText, "NSEC3 hash has padding: " << nsec3_str);
+ }
vector<uint8_t> next;
decodeBase32Hex(nexthash, next);
if (next.size() > 255) {
{
const size_t len1 = v1.size();
const size_t len2 = v2.size();
- const size_t cmplen = min(len1, len2);
if (check_length_first && len1 != len2) {
return (len1 - len2);
}
+ const size_t cmplen = min(len1, len2);
const int cmp = cmplen == 0 ? 0 : memcmp(&v1.at(0), &v2.at(0), cmplen);
if (cmp != 0) {
return (cmp);
"0123456789ABCDEFGHIJKLMNOPQRSTUV A NS SOA"),
InvalidRdataText);
+ // Next hash shouldn't be padded
+ EXPECT_THROW(generic::NSEC3("1 1 1 ADDAFEEE CPNMU=== A NS SOA"),
+ InvalidRdataText);
+
// Hash is too long. Max = 255 bytes, base32-hex converts each 5 bytes
// of the original to 8 characters, so 260 * 8 / 5 is the smallest length
// of the encoded string that exceeds the max and doesn't require padding.