algorithm_ = algorithm;
fingerprint_type_ = fingerprint_type;
- decodeHex(fingerprintbuf.str(), fingerprint_);
+
+ try {
+ decodeHex(fingerprintbuf.str(), fingerprint_);
+ } catch (const isc::BadValue& e) {
+ isc_throw(InvalidRdataText, "Bad SSHFP fingerprint: " << e.what());
+ }
}
SSHFP::SSHFP(uint8_t algorithm, uint8_t fingerprint_type,
algorithm_ = algorithm;
fingerprint_type_ = fingerprint_type;
- decodeHex(fingerprint, fingerprint_);
+
+ try {
+ decodeHex(fingerprint, fingerprint_);
+ } catch (const isc::BadValue& e) {
+ isc_throw(InvalidRdataText, "Bad SSHFP fingerprint: " << e.what());
+ }
}
SSHFP::SSHFP(const SSHFP& other) :
EXPECT_THROW(const generic::SSHFP rdata_sshfp("1"), InvalidRdataText);
EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 2"), InvalidRdataText);
EXPECT_THROW(const generic::SSHFP rdata_sshfp("BUCKLE MY SHOES"), InvalidRdataText);
- EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 2 foo bar"), isc::BadValue);
+ EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 2 foo bar"), InvalidRdataText);
}
TEST_F(Rdata_SSHFP_Test, copy) {