Nitrokey/OpenSCDP signing prehashed data with ECDSA

I have a smartcard shell plugin that receives a hash value. The original data is not accessible at this point. I need to create an ECDSA signature from the hash value but if i use ECDSA_SHA256 it will hash my hash.
In a similar situation for an RSA key i had to use RSA_PKCS1 to avoid hashing a second time.
Is there a similar algorithm for ECDSA? I see in SmartCardHSM.js (SmartCardHSMKey.prototype.sign function) of OpenSCDP shell there is mention of “useExternalHashInECDSA” and it switches to algorithm “0x70” (ecdsa without hash?) - this doesn’t seem too far away from what i need except that i already have my hash value. Id rather not modify the smartcard shell itself so I am hoping there is an easier way?

Maybe Crypto.ECDSA does what you need?

Yes, that results in 0x70 being sent, so i think you are right.
Thank you!

1 Like