-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Hi lovely cryptography folks. I just added the ability to sign server descriptors similar to what the tor process does but ran into one rough bit. In particular when cryptography makes an RSA signature it embeds a constant indicating the hash it uses whereas tor does not. This is buried pretty deep within cryptography's innards so I had to do an icky hack to be compatible with tor.
No doubt cryptography is doing the perfectly right thing here, but would you mind adding an option either to RSAPrivateKey's sign() method or the MultiBackend to omit this so we can drop the hack? In particular it's just two lines in the _rsa_sig_sign() method of cryptography/hazmat/backends/openssl/rsa.py we'd like to avoid...
197 res = backend._lib.EVP_PKEY_CTX_set_signature_md(
198 pkey_ctx, evp_md)
199 backend.openssl_assert(res > 0)
... to...
if include_hash_constant:
res = backend._lib.EVP_PKEY_CTX_set_signature_md(pkey_ctx, evp_md)
backend.openssl_assert(res > 0)
Cheers! -Damian
Metadata
Metadata
Assignees
Labels
No labels