Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
m32 committed Mar 5, 2024
1 parent 76d5266 commit 634fff1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions endesive/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ def sign(
)
else:
md = getattr(hashes, hashalgo.upper())
if hsm is not None:
salt_length = md.digest_size
elif isinstance(key, keys.PrivateKeyInfo):
if isinstance(key, keys.PrivateKeyInfo):
salt_length = key.byte_size - md.digest_size - 2
salt_length = md.digest_size
else:
salt_length = padding.calculate_max_pss_salt_length(key, md)
if key is None:
salt_length = md.digest_size
else:
salt_length = padding.calculate_max_pss_salt_length(key, md)
signer["signature_algorithm"] = algos.SignedDigestAlgorithm(
{
"algorithm": "rsassa_pss",
Expand Down

0 comments on commit 634fff1

Please sign in to comment.