diff options
author | Mukund Sivaraman <muks@isc.org> | 2014-01-14 12:46:26 +0100 |
---|---|---|
committer | Mukund Sivaraman <muks@isc.org> | 2014-01-14 12:49:27 +0100 |
commit | a99f8f2985db8650de25810cbb74cf5752c9e703 (patch) | |
tree | 0aef3c3afd1bf4f918096b1848afe224dcea5a20 | |
parent | [3287] Rename method (diff) | |
download | kea-a99f8f2985db8650de25810cbb74cf5752c9e703.tar.xz kea-a99f8f2985db8650de25810cbb74cf5752c9e703.zip |
[3287] Add getter for the fingerprint
-rw-r--r-- | src/lib/dns/rdata/generic/sshfp_44.cc | 7 | ||||
-rw-r--r-- | src/lib/dns/rdata/generic/sshfp_44.h | 2 | ||||
-rw-r--r-- | src/lib/dns/tests/rdata_sshfp_unittest.cc | 12 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc index a02fd1cda1..c243da7fef 100644 --- a/src/lib/dns/rdata/generic/sshfp_44.cc +++ b/src/lib/dns/rdata/generic/sshfp_44.cc @@ -14,8 +14,6 @@ #include <config.h> -#include <string> - #include <boost/lexical_cast.hpp> #include <exceptions/exceptions.h> @@ -293,6 +291,11 @@ SSHFP::getFingerprintType() const { return (impl_->fingerprint_type_); } +const std::vector<uint8_t>& +SSHFP::getFingerprint() const { + return (impl_->fingerprint_); +} + size_t SSHFP::getFingerprintLength() const { return (impl_->fingerprint_.size()); diff --git a/src/lib/dns/rdata/generic/sshfp_44.h b/src/lib/dns/rdata/generic/sshfp_44.h index ff1cd51a1c..85ae8067c5 100644 --- a/src/lib/dns/rdata/generic/sshfp_44.h +++ b/src/lib/dns/rdata/generic/sshfp_44.h @@ -17,6 +17,7 @@ #include <stdint.h> #include <string> +#include <vector> #include <dns/name.h> #include <dns/rdata.h> @@ -45,6 +46,7 @@ public: /// uint8_t getAlgorithmNumber() const; uint8_t getFingerprintType() const; + const std::vector<uint8_t>& getFingerprint() const; size_t getFingerprintLength() const; private: diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc index 5896ee5766..b2638ef6c7 100644 --- a/src/lib/dns/tests/rdata_sshfp_unittest.cc +++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc @@ -254,6 +254,18 @@ TEST_F(Rdata_SSHFP_Test, getFingerprintType) { EXPECT_EQ(1, rdata_sshfp.getFingerprintType()); } +TEST_F(Rdata_SSHFP_Test, getFingerprint) { + const std::vector<uint8_t>& fingerprint = + rdata_sshfp.getFingerprint(); + + EXPECT_EQ(rdata_sshfp.getFingerprintLength(), + fingerprint.size()); + for (int i = 0; i < fingerprint.size(); ++i) { + EXPECT_EQ(rdata_sshfp_wiredata[i + 2], + fingerprint.at(i)); + } +} + TEST_F(Rdata_SSHFP_Test, getFingerprintLength) { EXPECT_EQ(20, rdata_sshfp.getFingerprintLength()); } |