mech.mechanism = dnssec2smech[d_algorithm];
mech.pParameter = NULL;
mech.ulParameterLen = 0;
- if (d_slot->Sign(msg, result, &mech)) throw PDNSException("Could not sign data");
+
+ if (mech.mechanism == CKM_ECDSA) {
+ if (d_slot->Sign(this->hash(msg), result, &mech)) throw PDNSException("Could not sign data");
+ } else {
+ if (d_slot->Sign(msg, result, &mech)) throw PDNSException("Could not sign data");
+ }
return result;
};
mech.mechanism = dnssec2smech[d_algorithm];
mech.pParameter = NULL;
mech.ulParameterLen = 0;
- return (d_slot->Verify(msg, signature, &mech) == 0);
+ if (mech.mechanism == CKM_ECDSA) {
+ return (d_slot->Verify(this->hash(msg), signature, &mech)==0);
+ } else {
+ return (d_slot->Verify(msg, signature, &mech) == 0);
+ }
};
std::string PKCS11DNSCryptoKeyEngine::getPubKeyHash() const {