-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.5.15: circular imports and issue with get_PYKCS11LIB
module on testing
#115
Comments
Just found |
To build the documentation use:
To run the tests:
|
You are using unittest and correctly written test suite i correctly handled by pytest. Building: every module should be compliant with PEP517 methodology. |
For the tests:
works for me. Feel free to propose a patch if you need something more/else. |
For me it does not work because that script is not checking arch dependent libdir. Just tested with Here is pytest output:+ 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 = <test.test_LowLevel.TestUtil testMethod=test_LowLevel>
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 = <test.test_asymetric.TestUtil testMethod=test_RSA_OAEP>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d59360b0>, 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 = <test.test_asymetric.TestUtil testMethod=test_RSA_OAEPwithAAD>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57ece80>, 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 = <test.test_asymetric.TestUtil testMethod=test_RSA_PSS_SHA1>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d51a51e0>, 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 = <test.test_asymetric.TestUtil testMethod=test_RSA_PSS_SHA256>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d59488b0>, 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 = <test.test_asymetric.TestUtil testMethod=test_encrypt_PKCS>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d58ca260>, 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 = <test.test_asymetric.TestUtil testMethod=test_encrypt_X509>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d51a7910>, 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 = <test.test_asymetric.TestUtil testMethod=test_pubKey>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53009a0>, 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 = <test.test_asymetric.TestUtil testMethod=test_sign_PKCS>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586d2a0>, 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 = <test.test_asymetric.TestUtil testMethod=test_sign_PKCS_SHA256>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d59a4fa0>, 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 = <test.test_asymetric.TestUtil testMethod=test_sign_X509>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57b1360>, 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 = <test.test_asymetric.TestUtil testMethod=test_sign_integer>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d5301ab0>, 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 = <test.test_asymetric_ECC.TestUtil testMethod=test_sign_integer>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric_ECC.py:9:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d58c89d0>, 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 = <test.test_asymetric_ECC.TestUtil testMethod=test_sign_text>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric_ECC.py:9:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57efcd0>, 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 = <test.test_asymetric_gost.TestUtil testMethod=test_gost>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_asymetric_gost.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53efa90>, 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 = <test.test_derive.TestUtil testMethod=test_deriveKey_ECDH1_DERIVE>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_derive.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586e4a0>, 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 = <test.test_digest.TestUtil testMethod=test_digest>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_digest.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53013c0>, 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 = <test.test_digest.TestUtil testMethod=test_digestSession>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_digest.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d587d6c0>, 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 = <test.test_gc.TestUtil testMethod=test_gc>
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 = <PyKCS11.PyKCS11Lib object at 0x7fe4d53eece0>, 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 = <test.test_info.TestUtil testMethod=test_getInfo>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_info.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53c7730>, 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 = <test.test_info.TestUtil testMethod=test_getMechanismList>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_info.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53b5570>, 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 = <test.test_info.TestUtil testMethod=test_getSessionInfo>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_info.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586d6f0>, 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 = <test.test_info.TestUtil testMethod=test_getSlotInfo>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_info.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53c7940>, 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 = <test.test_info.TestUtil testMethod=test_getTokenInfo>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_info.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53b7be0>, 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 = <test.test_init.TestUtil testMethod=test_initPin>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_init.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586e680>, 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 = <test.test_init.TestUtil testMethod=test_initToken>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_init.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53ed9f0>, 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 = <test.test_init.TestUtil testMethod=test_initToken_utf8>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_init.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d58ca530>, 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 = <test.test_init.TestUtil testMethod=test_setPin>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_init.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d51a79d0>, 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 = <test.test_objects.TestUtil testMethod=test_objects>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_objects.py:12:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53b6140>, 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 = <test.test_objects.TestGetSetAttributeValues testMethod=test_getAttributeValue>
def setUp(self) -> None:
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_objects.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586e7a0>, 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 = <test.test_objects.TestGetSetAttributeValues testMethod=test_setAttributeValue_with_a_list_of_attributes>
def setUp(self) -> None:
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_objects.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d58c9600>, 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 = <test.test_objects.TestGetSetAttributeValues testMethod=test_setAttributeValue_with_label_attribute>
def setUp(self) -> None:
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_objects.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57b0190>, 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 = <test.test_objects.TestGetSetAttributeValues testMethod=test_setAttributeValue_with_single_binary_attribute>
def setUp(self) -> None:
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_objects.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d594ae90>, 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 = <test.test_pin.TestUtil testMethod=test_binary>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_pin.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57ec610>, 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 = <test.test_pin.TestUtil testMethod=test_ckbytelist>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_pin.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586c640>, 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 = <test.test_pin.TestUtil testMethod=test_login>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_pin.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d51a4a90>, 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 = <test.test_pin.TestUtil testMethod=test_null>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_pin.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53b52d0>, 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 = <test.test_pin.TestUtil testMethod=test_wrong>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_pin.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d587f4f0>, 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 = <test.test_random.TestUtil testMethod=test_generateRandom>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_random.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d5300550>, 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 = <test.test_random.TestUtil testMethod=test_seedRandom>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_random.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57ed180>, 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 = <test.test_symetric.TestUtil testMethod=test_symetric>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_symetric.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d587cc10>, 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 = <test.test_wrap.TestUtil testMethod=test_wrapKey>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_wrap.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d53c43a0>, 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 = <test.test_wrap.TestUtil testMethod=test_wrapKey_OAEP>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_wrap.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d57edab0>, 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 = <test.test_wrap.TestUtil testMethod=test_wrapKey_UNWRAP_TEMPLATE>
def setUp(self):
self.pkcs11 = PyKCS11.PyKCS11Lib()
> self.pkcs11.load()
test/test_wrap.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PyKCS11.PyKCS11Lib object at 0x7fe4d586d480>, 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 =============================================================================== |
libsofthsm2 is just ONE PKCS#11 library that can be used with PyKCS11. 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? |
Looks like it can be done from non-root account so it can be done as well in pytest session as part of it.
Quote from opening this ticket:
|
Can you propose a patch? |
First would be good to resolve all those IMO possible patch could make location of the libsofthsm2.so detection in setu.py and than generate PyKCS11/init.py with proper path. |
On building documentation sphinx shows warnings about circular imports
And looks like test suite needs
get_PYKCS11LIB
module but I cannot find on pypi what provides it.May I ask for some hint? 🤔
The text was updated successfully, but these errors were encountered: