summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/nsec3hash.h
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@isc.org>2012-09-24 23:20:41 +0200
committerMukund Sivaraman <muks@isc.org>2012-09-24 23:20:41 +0200
commit56a18b6b8dc444efeec0052eefc4539633e9a762 (patch)
tree19e3dbad1aa515c89649fcb2cbbe8b54cb0d03d3 /src/lib/dns/nsec3hash.h
parent[2218] Update message used in throw (diff)
downloadkea-56a18b6b8dc444efeec0052eefc4539633e9a762.tar.xz
kea-56a18b6b8dc444efeec0052eefc4539633e9a762.zip
[2218] Add a NSEC3Hash::create() variant to take hash params as args
Diffstat (limited to 'src/lib/dns/nsec3hash.h')
-rw-r--r--src/lib/dns/nsec3hash.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/lib/dns/nsec3hash.h b/src/lib/dns/nsec3hash.h
index 35b7b30054..357f4e7c22 100644
--- a/src/lib/dns/nsec3hash.h
+++ b/src/lib/dns/nsec3hash.h
@@ -16,6 +16,7 @@
#define __NSEC3HASH_H 1
#include <string>
+#include <vector>
#include <stdint.h>
#include <exceptions/exceptions.h>
@@ -115,6 +116,13 @@ public:
/// for hash calculation from an NSEC3 RDATA object.
static NSEC3Hash* create(const rdata::generic::NSEC3& nsec3);
+ /// \brief Factory method of NSECHash from args.
+ ///
+ /// This is similar to the other version, but uses the arguments
+ /// passed as the parameters for hash calculation.
+ static NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
+ const std::vector<uint8_t>& salt);
+
/// \brief The destructor.
virtual ~NSEC3Hash() {}
@@ -131,15 +139,6 @@ public:
/// \return Base32hex-encoded string of the hash value.
virtual std::string calculate(const Name& name) const = 0;
- /// \brief Calculate the NSEC3 SHA-1 hash.
- ///
- /// This method calculates the NSEC3 hash value for the given
- /// \c name and hash parameters. It assumes the SHA-1 algorithm.
- static std::string calculate(const Name& name,
- const uint16_t iterations,
- const uint8_t* salt,
- size_t salt_len);
-
/// \brief Match given NSEC3 parameters with that of the hash.
///
/// This method compares NSEC3 parameters used for hash calculation
@@ -219,6 +218,14 @@ public:
/// <code>NSEC3Hash::create(const rdata::generic::NSEC3& param)</code>
virtual NSEC3Hash* create(const rdata::generic::NSEC3& nsec3)
const = 0;
+
+ /// \brief Factory method of NSECHash from args.
+ ///
+ /// See
+ /// <code>NSEC3Hash::create(const rdata::generic::NSEC3& param)</code>
+ virtual NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
+ const std::vector<uint8_t>& salt)
+ const = 0;
};
/// \brief The default NSEC3Hash creator.
@@ -234,6 +241,8 @@ class DefaultNSEC3HashCreator : public NSEC3HashCreator {
public:
virtual NSEC3Hash* create(const rdata::generic::NSEC3PARAM& param) const;
virtual NSEC3Hash* create(const rdata::generic::NSEC3& nsec3) const;
+ virtual NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
+ const std::vector<uint8_t>& salt) const;
};
/// \brief The registrar of \c NSEC3HashCreator.