LudovicRousseau / PyKCS11

PKCS#11 Wrapper for Python
GNU General Public License v2.0
98 stars 35 forks source link

1.5.15: circular imports and issue with `get_PYKCS11LIB` module on testing #115

Open kloczek opened 5 months ago

kloczek commented 5 months ago

On building documentation sphinx shows warnings about circular imports

+ /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v7.3.7
making output directory... done
[autosummary] generating autosummary for: api.rst, index.rst, license.rst, samples.rst
WARNING: Failed to import PyKCS11.
Possible hints:
* ImportError: cannot import name '_LowLevel' from partially initialized module 'PyKCS11' (most likely due to a circular import) (/home/tkloczko/rpmbuild/BUILD/PyKCS11-1.5.15/PyKCS11/__init__.py)
* KeyError: 'PyKCS11'
building [mo]: targets for 0 po files that are out of date
writing output...
building [man]: all manpages
updating environment: [new config] 4 added, 0 changed, 0 removed
reading sources... [100%] samples
WARNING: autodoc: failed to import module 'PyKCS11'; the following exception was raised:
cannot import name '_LowLevel' from partially initialized module 'PyKCS11' (most likely due to a circular import) (/home/tkloczko/rpmbuild/BUILD/PyKCS11-1.5.15/PyKCS11/__init__.py)
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-pykcs11.3 { api samples license } done
build succeeded, 2 warnings.

And looks like test suite needs get_PYKCS11LIB module but I cannot find on pypi what provides it.

+ /usr/bin/pytest -ra -m 'not network' --import-mode=importlib
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/PyKCS11-1.5.15
configfile: pyproject.toml
collected 70 items / 1 error

========================================================================================== ERRORS ===========================================================================================
_______________________________________________________________________________ ERROR collecting run_test.py ________________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/PyKCS11-1.5.15/run_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
run_test.py:11: in <module>
    import get_PYKCS11LIB
E   ModuleNotFoundError: No module named 'get_PYKCS11LIB'
================================================================================== short test summary info ==================================================================================
ERROR run_test.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 1 error in 0.19s ======================================================================================

May I ask for some hint? 🤔

kloczek commented 5 months ago

Just found get_PYKCS11LIB in source root directory 😋 Nevertheless that location is not well suited for parts of the test suite.. Probably the best would be just integrate that into run_test.py.

LudovicRousseau commented 5 months ago

To build the documentation use:

docs/generate.sh

To run the tests:

  1. build and install PyKCS11 as documented in https://github.com/LudovicRousseau/PyKCS11?tab=readme-ov-file#unix-build-howto
  2. and run:
    ./run_test.py
kloczek commented 5 months ago

You are using unittest and correctly written test suite i correctly handled by pytest. Conclusion: your test suite is not correct even for unittest. It would be good to fix that.

Building: every module should be compliant with PEP517 methodology. As you see that methodology build procedurę shows warnings.

LudovicRousseau commented 5 months ago

For the tests:

export $(./get_PYKCS11LIB.py)
pytest -ra -m 'not network'

works for me.

Feel free to propose a patch if you need something more/else.

kloczek commented 5 months ago

For the tests:

export $(./get_PYKCS11LIB.py)
pytest -ra -m 'not network'

works for me.

For me it does not work because that script is not checking arch dependent libdir. Other thing is that instead using env variable better would be detect on build stage where this library is and than generate PyKCS11/init.py to hardcode that path into that file.

Just tested with export PYKCS11LIB=/usr/lib64/softhsm/libsofthsm2.so and test suite still fails

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib test ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0 rootdir: /home/tkloczko/rpmbuild/BUILD/PyKCS11-1.5.15 configfile: pyproject.toml plugins: hypothesis-6.100.0, asyncio-0.23.6, mock-3.14.0, typeguard-4.2.1 asyncio: mode=strict collected 70 items test/test_CK.py ... [ 4%] test/test_LowLevel.py F [ 5%] test/test_asymetric.py FFFFFFFFFFF [ 21%] test/test_asymetric_ECC.py FF [ 24%] test/test_asymetric_gost.py F [ 25%] test/test_ckbytelist.py .............. [ 45%] test/test_derive.py F [ 47%] test/test_digest.py FF [ 50%] test/test_exception.py ........ [ 61%] test/test_gc.py F [ 62%] test/test_info.py FFFFF [ 70%] test/test_init.py FFFF [ 75%] test/test_load.py . [ 77%] test/test_objects.py FFFFF [ 84%] test/test_pin.py FFFFF [ 91%] test/test_random.py FF [ 94%] test/test_symetric.py F [ 95%] test/test_wrap.py FFF [100%] ========================================================================================= FAILURES ========================================================================================== __________________________________________________________________________________ TestUtil.test_LowLevel ___________________________________________________________________________________ self = def test_LowLevel(self): a = PyKCS11.LowLevel.CPKCS11Lib() self.assertIsNotNone(a) # File not found self.assertEqual(a.Load("NoFile"), -1) # C_GetFunctionList() not found if platform.system() == 'Linux': # GNU/Linux lib = "libc.so.6" elif platform.system() == 'Darwin': # macOS lib = "/usr/lib/libSystem.B.dylib" else: # Windows lib = "WinSCard.dll" self.assertEqual(a.Load(lib), -4) info = PyKCS11.LowLevel.CK_INFO() self.assertIsNotNone(info) slotInfo = PyKCS11.LowLevel.CK_SLOT_INFO() self.assertIsNotNone(slotInfo) lib = os.getenv("PYKCS11LIB") if lib is None: raise (Exception("Define PYKCS11LIB")) session = PyKCS11.LowLevel.CK_SESSION_HANDLE() self.assertIsNotNone(session) sessionInfo = PyKCS11.LowLevel.CK_SESSION_INFO() self.assertIsNotNone(sessionInfo) tokenInfo = PyKCS11.LowLevel.CK_TOKEN_INFO() self.assertIsNotNone(tokenInfo) slotList = PyKCS11.LowLevel.ckintlist() self.assertIsNotNone(slotList) a.Load(lib) > self.assertEqual(a.C_GetInfo(info), PyKCS11.LowLevel.CKR_OK) E AssertionError: 400 != 0 test/test_LowLevel.py:52: AssertionError __________________________________________________________________________________ TestUtil.test_RSA_OAEP ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________________________________ TestUtil.test_RSA_OAEPwithAAD _______________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_RSA_PSS_SHA1 _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________________________________ TestUtil.test_RSA_PSS_SHA256 ________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_encrypt_PKCS _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_encrypt_X509 _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_pubKey ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error __________________________________________________________________________________ TestUtil.test_sign_PKCS __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ______________________________________________________________________________ TestUtil.test_sign_PKCS_SHA256 _______________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error __________________________________________________________________________________ TestUtil.test_sign_X509 __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_sign_integer _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_sign_integer _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric_ECC.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error __________________________________________________________________________________ TestUtil.test_sign_text __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric_ECC.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ____________________________________________________________________________________ TestUtil.test_gost _____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_asymetric_gost.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________ TestUtil.test_deriveKey_ECDH1_DERIVE ____________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_derive.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_digest ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_digest.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_digestSession ________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_digest.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _____________________________________________________________________________________ TestUtil.test_gc ______________________________________________________________________________________ self = def test_gc(self): res = list() # we must use at least 2 sessions for n in range(2): > p11, session = self.createSession() test/test_gc.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/test_gc.py:23: in createSession pkcs11.load() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_getInfo ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_info.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ______________________________________________________________________________ TestUtil.test_getMechanismList _______________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_info.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________________________________ TestUtil.test_getSessionInfo ________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_info.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _________________________________________________________________________________ TestUtil.test_getSlotInfo _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_info.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_getTokenInfo _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_info.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_initPin ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_init.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error __________________________________________________________________________________ TestUtil.test_initToken __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_init.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________________________________ TestUtil.test_initToken_utf8 ________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_init.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_setPin ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_init.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_objects ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_objects.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _____________________________________________________________________ TestGetSetAttributeValues.test_getAttributeValue ______________________________________________________________________ self = def setUp(self) -> None: self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_objects.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________ TestGetSetAttributeValues.test_setAttributeValue_with_a_list_of_attributes _________________________________________________________ self = def setUp(self) -> None: self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_objects.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________ TestGetSetAttributeValues.test_setAttributeValue_with_label_attribute ___________________________________________________________ self = def setUp(self) -> None: self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_objects.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________ TestGetSetAttributeValues.test_setAttributeValue_with_single_binary_attribute _______________________________________________________ self = def setUp(self) -> None: self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_objects.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_binary ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_pin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _________________________________________________________________________________ TestUtil.test_ckbytelist __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_pin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ____________________________________________________________________________________ TestUtil.test_login ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_pin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ____________________________________________________________________________________ TestUtil.test_null _____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_pin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ____________________________________________________________________________________ TestUtil.test_wrong ____________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_pin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _______________________________________________________________________________ TestUtil.test_generateRandom ________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_random.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error _________________________________________________________________________________ TestUtil.test_seedRandom __________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_random.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error __________________________________________________________________________________ TestUtil.test_symetric ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_symetric.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________________ TestUtil.test_wrapKey ___________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_wrap.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ________________________________________________________________________________ TestUtil.test_wrapKey_OAEP _________________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_wrap.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ___________________________________________________________________________ TestUtil.test_wrapKey_UNWRAP_TEMPLATE ___________________________________________________________________________ self = def setUp(self): self.pkcs11 = PyKCS11.PyKCS11Lib() > self.pkcs11.load() test/test_wrap.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , pkcs11dll_filename = '/usr/lib64/softhsm/libsofthsm2.so', init_string = (), rv = 5 def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): when the load fails """ if pkcs11dll_filename is None: pkcs11dll_filename = os.getenv("PYKCS11LIB") if pkcs11dll_filename is None: raise PyKCS11Error(-1, "No PKCS11 library specified (set PYKCS11LIB env variable)") # remember the lib file name self.pkcs11dll_filename = pkcs11dll_filename # if the lib is already in use: reuse it if pkcs11dll_filename in PyKCS11Lib._loaded_libs: self.lib.Duplicate(PyKCS11Lib._loaded_libs[pkcs11dll_filename]["ref"]) else: # else load it rv = self.lib.Load(pkcs11dll_filename) if rv != CKR_OK: > raise PyKCS11Error(rv, pkcs11dll_filename) E PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) ../../BUILDROOT/python-PyKCS11-1.5.15-2.fc37.x86_64/usr/lib64/python3.10/site-packages/PyKCS11/__init__.py:518: PyKCS11Error ================================================================================== short test summary info ================================================================================== FAILED test/test_LowLevel.py::TestUtil::test_LowLevel - AssertionError: 400 != 0 FAILED test/test_asymetric.py::TestUtil::test_RSA_OAEP - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_RSA_OAEPwithAAD - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_RSA_PSS_SHA1 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_RSA_PSS_SHA256 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_encrypt_PKCS - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_encrypt_X509 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_pubKey - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_sign_PKCS - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_sign_PKCS_SHA256 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_sign_X509 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric.py::TestUtil::test_sign_integer - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric_ECC.py::TestUtil::test_sign_integer - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric_ECC.py::TestUtil::test_sign_text - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_asymetric_gost.py::TestUtil::test_gost - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_derive.py::TestUtil::test_deriveKey_ECDH1_DERIVE - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_digest.py::TestUtil::test_digest - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_digest.py::TestUtil::test_digestSession - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_gc.py::TestUtil::test_gc - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_info.py::TestUtil::test_getInfo - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_info.py::TestUtil::test_getMechanismList - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_info.py::TestUtil::test_getSessionInfo - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_info.py::TestUtil::test_getSlotInfo - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_info.py::TestUtil::test_getTokenInfo - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_init.py::TestUtil::test_initPin - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_init.py::TestUtil::test_initToken - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_init.py::TestUtil::test_initToken_utf8 - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_init.py::TestUtil::test_setPin - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_objects.py::TestUtil::test_objects - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_objects.py::TestGetSetAttributeValues::test_getAttributeValue - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_objects.py::TestGetSetAttributeValues::test_setAttributeValue_with_a_list_of_attributes - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_objects.py::TestGetSetAttributeValues::test_setAttributeValue_with_label_attribute - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_objects.py::TestGetSetAttributeValues::test_setAttributeValue_with_single_binary_attribute - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_pin.py::TestUtil::test_binary - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_pin.py::TestUtil::test_ckbytelist - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_pin.py::TestUtil::test_login - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_pin.py::TestUtil::test_null - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_pin.py::TestUtil::test_wrong - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_random.py::TestUtil::test_generateRandom - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_random.py::TestUtil::test_seedRandom - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_symetric.py::TestUtil::test_symetric - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_wrap.py::TestUtil::test_wrapKey - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_wrap.py::TestUtil::test_wrapKey_OAEP - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) FAILED test/test_wrap.py::TestUtil::test_wrapKey_UNWRAP_TEMPLATE - PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) =============================================================================== 44 failed, 26 passed in 2.19s =============================================================================== ```
LudovicRousseau commented 5 months ago

libsofthsm2 is just ONE PKCS#11 library that can be used with PyKCS11. I use it for testing but in "the real life" you would use another PKCS#11 library and a smart card.

You need to setup your software libsofthsm2 token using https://github.com/LudovicRousseau/PyKCS11/blob/master/test/reset_softHSM.sh

Why are you using PyKCS11?

kloczek commented 5 months ago

You need to setup your software libsofthsm2 token using https://github.com/LudovicRousseau/PyKCS11/blob/master/test/reset_softHSM.sh

Looks like it can be done from non-root account so it can be done as well in pytest session as part of it.

Why are you using PyKCS11?

Quote from opening this ticket:

On building documentation sphinx shows warnings about circular imports

LudovicRousseau commented 5 months ago

Can you propose a patch?

kloczek commented 5 months ago

Can you propose a patch?

First would be good to resolve all those PyKCS11.PyKCS11Error: CKR_GENERAL_ERROR (0x00000005) fails.

IMO possible patch could make location of the libsofthsm2.so detection in setu.py and than generate PyKCS11/init.py with proper path.