# Nitrokey/OpenSCDP signing prehashed data with ECDSA

**URL:** <https://support.nitrokey.com/t/nitrokey-openscdp-signing-prehashed-data-with-ecdsa/4886>\
**Category:** Misc\
**Created:** [March 9, 2023, 5:44pm UTC](https://support.nitrokey.com/t/nitrokey-openscdp-signing-prehashed-data-with-ecdsa/4886 "2023-03-09T17:44:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougvs](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@dougvs](https://support.nitrokey.com/u/dougvs)\
**Post date:** [March 9, 2023, 5:44pm UTC](https://support.nitrokey.com/t/nitrokey-openscdp-signing-prehashed-data-with-ecdsa/4886/1 "2023-03-09T17:44:18Z")

</div>

Hi,  
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?  
Thanks,  
Doug

---

<div class="post-metadata">

**Author:** ![saper](https://support.nitrokey.com/user_avatar/support.nitrokey.com/saper/32/493_2.png) [@saper](https://support.nitrokey.com/u/saper)\
**Post date:** [March 9, 2023, 6:07pm UTC](https://support.nitrokey.com/t/nitrokey-openscdp-signing-prehashed-data-with-ecdsa/4886/2 "2023-03-09T18:07:10Z")

</div>

Maybe `Crypto.ECDSA` does what you need?

---

<div class="post-metadata">

**Author:** ![dougvs](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@dougvs](https://support.nitrokey.com/u/dougvs)\
**Post date:** [March 9, 2023, 6:17pm UTC](https://support.nitrokey.com/t/nitrokey-openscdp-signing-prehashed-data-with-ecdsa/4886/3 "2023-03-09T18:17:44Z")

</div>

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