Is your feature request related to a problem?
Currently, espsecure sign-data --hsm uses the SHA256_RSA_PKCS_PSS or ECDSA_SHA256 PKCS#11 mechanisms for the signature generation calls (see get_mechanism()).
These mechanisms do two things: hash the input data and afterwards perform the signing operation on the digest.
We wanted to test espsecure sign-data with our (SignPath) own PKCS#11 CryptoProvider which currently doesn't support these PKCS#11 mechanisms, but CKM_RSA_PKCS_PSS / CKM_ECDSA (which take an pre-calculated hash as input).
As this may be also an issue with other CryptoProviders / HSMs, it's maybe better to switch to the more low-level CKM_RSA_PKCS_PSS / CKM_ECDSA mechanisms in espsecure and calculate the input hash before (in the Python part).
What do you think about this idea?