Skip to content

Commit

Permalink
Temp logging on pkcs11 failures
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasValvekens committed Mar 5, 2024
1 parent c9eb033 commit eb4105f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pyhanko/sign/pkcs11.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
e,
)


__all__ = [
'PKCS11Signer',
'open_pkcs11_session',
Expand Down Expand Up @@ -164,7 +163,6 @@ class PKCS11SignatureOperationSpec:
'sha512': Mechanism.SHA512_RSA_PKCS,
}


RSASSA_PSS_MECH_MAP = {
'sha1': Mechanism.SHA1_RSA_PKCS_PSS,
'sha224': Mechanism.SHA224_RSA_PKCS_PSS,
Expand All @@ -181,7 +179,6 @@ class PKCS11SignatureOperationSpec:
'sha512': MGF.SHA512,
}


ECDSA_MECH_MAP = {
'sha1': Mechanism.ECDSA_SHA1,
'sha224': Mechanism.ECDSA_SHA224,
Expand All @@ -190,7 +187,6 @@ class PKCS11SignatureOperationSpec:
'sha512': Mechanism.ECDSA_SHA512,
}


DSA_MECH_MAP = {
'sha1': Mechanism.DSA_SHA1,
'sha224': Mechanism.DSA_SHA224,
Expand All @@ -203,7 +199,6 @@ class PKCS11SignatureOperationSpec:
'sha512': Mechanism.DSA_SHA512,
}


DIGEST_MECH_MAP = {
'sha1': Mechanism.SHA_1,
'sha224': Mechanism.SHA224,
Expand Down Expand Up @@ -728,6 +723,9 @@ def _instantiate(self) -> PKCS11Signer:
user_pin=pin,
)
except pkcs11.PKCS11Error as ex:
import os

logger.info(f"ENVIRONMENT ON PKCS#11 FAILURE: {os.environ}")
raise SigningError(
f"PKCS#11 error while opening session to {config.module_path}: [{type(ex).__name__}] {ex}"
) from ex
Expand Down

0 comments on commit eb4105f

Please sign in to comment.