L<<Logger::Error<<"Packet for domain '"<<q->qdomain<<"' denied: can't find TSIG key with name '"<<*keyname<<"' and algorithm '"<<trc->d_algoName<<"'"<<endl;
return false;
}
- trc->d_algoName += ".sig-alg.reg.int.";
+
+ if (trc->d_algoName == "hmac-md5")
+ rc->d_algoName += ".sig-alg.reg.int.";
+
+ if (trc->d_algoName != "hmac-md5.sig-alg.reg.int.") {
+ L<<Logger::Error<<"Unsupported TSIG HMAC algorithm " << trc->d_algoName << endl;
+ return false;
+ }
+
B64Decode(secret64, *secret);
bool result=calculateMD5HMAC(*secret, message) == trc->d_mac;
if(!result) {
void addTSIG(DNSPacketWriter& pw, TSIGRecordContent* trc, const string& tsigkeyname, const string& tsigsecret, const string& tsigprevious, bool timersonly)
{
+ if (trc->d_algoName != "hmac-md5.sig-alg.reg.int.") {
+ L<<Logger::Error<<"Unsupported HMAC TSIG algorithm " << trc->d_algoName << endl;
+ return;
+ }
+
string toSign;
if(!tsigprevious.empty()) {
uint16_t len = htons(tsigprevious.length());
if(!tsigkeyname.empty()) {
// cerr<<"Adding TSIG to notification, key name: '"<<tsigkeyname<<"', algo: '"<<tsigalgorithm<<"', secret: "<<Base64Encode(tsigsecret)<<endl;
TSIGRecordContent trc;
- trc.d_algoName = tsigalgorithm + ".sig-alg.reg.int.";
+ if (tsigalgorithm == "hmac-md5")
+ trc.d_algoName = tsigalgorithm + ".sig-alg.reg.int.";
trc.d_time = time(0);
trc.d_fudge = 300;
trc.d_origID=ntohs(d_randomid);