python-pkcs11 0.9.5__tar.gz → 0.10.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/actions/test-setup/action.yml +2 -2
  2. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/workflows/coverage.yml +7 -7
  3. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/workflows/quality.yml +3 -3
  4. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/workflows/release.yml +14 -14
  5. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/workflows/tests.yml +4 -2
  6. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/PKG-INFO +2 -1
  7. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/conf.py +0 -1
  8. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/load_module.c +2 -0
  9. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/load_module.h +2 -1
  10. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/__init__.py +0 -2
  11. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/_pkcs11.pxd +165 -0
  12. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/_pkcs11.pyi +2 -5
  13. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/_pkcs11.pyx +181 -66
  14. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/attributes.py +8 -3
  15. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/constants.py +12 -2
  16. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/defaults.py +8 -0
  17. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/mechanisms.py +21 -5
  18. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/types.py +91 -12
  19. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pyproject.toml +2 -0
  20. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/PKG-INFO +2 -1
  21. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/SOURCES.txt +1 -0
  22. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/scm_file_list.json +43 -42
  23. python_pkcs11-0.10.1/python_pkcs11.egg-info/scm_version.json +8 -0
  24. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/__init__.py +1 -1
  25. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_aes.py +8 -17
  26. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_attributes.py +0 -0
  27. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_dsa.py +1 -1
  28. python_pkcs11-0.10.1/tests/test_ml_kem.py +82 -0
  29. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_rsa.py +1 -2
  30. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_sessions.py +2 -3
  31. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_slots_and_tokens.py +1 -1
  32. python_pkcs11-0.10.1/uv.lock +1278 -0
  33. python_pkcs11-0.9.5/python_pkcs11.egg-info/scm_version.json +0 -8
  34. python_pkcs11-0.9.5/uv.lock +0 -1169
  35. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/actions/install-opencryptoki/action.yml +0 -0
  36. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/actions/install-softhsm/action.yml +0 -0
  37. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.github/release-template.md +0 -0
  38. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.gitignore +0 -0
  39. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.python-version +0 -0
  40. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/.readthedocs.yaml +0 -0
  41. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/LICENSE +0 -0
  42. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/MANIFEST.in +0 -0
  43. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/README.rst +0 -0
  44. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/Makefile +0 -0
  45. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/api.rst +0 -0
  46. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/applied.rst +0 -0
  47. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/concurrency.rst +0 -0
  48. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/index.rst +0 -0
  49. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/make.bat +0 -0
  50. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/docs/opensc.rst +0 -0
  51. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/.gitignore +0 -0
  52. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/cryptoki.h +0 -0
  53. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/pkcs11.h +0 -0
  54. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/pkcs11f.h +0 -0
  55. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/extern/pkcs11t.h +0 -0
  56. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/exceptions.py +0 -0
  57. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/py.typed +0 -0
  58. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/__init__.py +0 -0
  59. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/dh.py +0 -0
  60. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/dsa.py +0 -0
  61. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/ec.py +0 -0
  62. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/rsa.py +0 -0
  63. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/pkcs11/util/x509.py +0 -0
  64. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/dependency_links.txt +0 -0
  65. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/requires.txt +0 -0
  66. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/python_pkcs11.egg-info/top_level.txt +0 -0
  67. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/setup.cfg +0 -0
  68. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_des.py +0 -0
  69. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_dh.py +0 -0
  70. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_digest.py +0 -0
  71. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_ecc.py +0 -0
  72. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_iterators.py +0 -0
  73. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_ml_dsa.py +0 -0
  74. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_multilib.py +0 -0
  75. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_public_key_external.py +0 -0
  76. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_threading.py +0 -0
  77. {python_pkcs11-0.9.5 → python_pkcs11-0.10.1}/tests/test_x509.py +0 -0
@@ -34,7 +34,7 @@ runs:
34
34
  using: "composite"
35
35
  steps:
36
36
  - name: Setup Python
37
- uses: actions/setup-python@v6
37
+ uses: actions/setup-python@v7
38
38
  with:
39
39
  python-version: ${{ inputs.python-version }}
40
40
  - uses: ./.github/actions/install-softhsm
@@ -78,7 +78,7 @@ runs:
78
78
  env:
79
79
  PLATFORM: ${{ inputs.pkcs11-platform }}
80
80
  - name: Install uv
81
- uses: astral-sh/setup-uv@v7
81
+ uses: astral-sh/setup-uv@v10.3.0
82
82
  with:
83
83
  enable-cache: true
84
84
  python-version: ${{ inputs.python-version }}
@@ -23,7 +23,7 @@ jobs:
23
23
  - opencryptoki
24
24
  steps:
25
25
  - name: Acquire sources
26
- uses: actions/checkout@v6
26
+ uses: actions/checkout@v7
27
27
  - name: Arm coverage-only compiler directives
28
28
  # Unfortunately, it doesn't seem to be possible to pass directives
29
29
  # to Cython through environment variables: https://github.com/cython/cython/issues/3930
@@ -48,7 +48,7 @@ jobs:
48
48
  env:
49
49
  PKCS11_MODULE: ${{ steps.setup.outputs.module }}
50
50
  - name: Stash coverage report
51
- uses: actions/upload-artifact@v4
51
+ uses: actions/upload-artifact@v7
52
52
  with:
53
53
  name: coverage-${{ strategy.job-index }}
54
54
  path: "*-coverage.xml"
@@ -56,7 +56,7 @@ jobs:
56
56
  runs-on: ubuntu-26.04
57
57
  steps:
58
58
  - name: Acquire sources
59
- uses: actions/checkout@v6
59
+ uses: actions/checkout@v7
60
60
  - uses: ./.github/actions/test-setup
61
61
  id: setup
62
62
  with:
@@ -73,7 +73,7 @@ jobs:
73
73
  PKCS11_MODULE: ${{ steps.setup.outputs.module }}
74
74
  PKCS11_MODULE2: ${{ steps.setup.outputs.module2 }}
75
75
  - name: Stash coverage report
76
- uses: actions/upload-artifact@v4
76
+ uses: actions/upload-artifact@v7
77
77
  with:
78
78
  name: coverage-multilib
79
79
  path: "*-coverage.xml"
@@ -85,14 +85,14 @@ jobs:
85
85
  needs: [pytest-coverage,pytest-coverage-multilib]
86
86
  steps:
87
87
  # checkout necessary to ensure the uploaded report contains the correct paths
88
- - uses: actions/checkout@v6
88
+ - uses: actions/checkout@v7
89
89
  - name: Retrieve coverage reports
90
- uses: actions/download-artifact@v4
90
+ uses: actions/download-artifact@v8
91
91
  with:
92
92
  pattern: coverage-*
93
93
  path: ./reports/
94
94
  - name: Upload all coverage reports to Codecov
95
- uses: codecov/codecov-action@v5
95
+ uses: codecov/codecov-action@v7
96
96
  with:
97
97
  token: ${{ secrets.CODECOV_TOKEN }}
98
98
  directory: ./reports/
@@ -10,15 +10,15 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
12
  - name: Acquire sources
13
- uses: actions/checkout@v6
13
+ uses: actions/checkout@v7
14
14
 
15
15
  - name: Install uv
16
- uses: astral-sh/setup-uv@v7
16
+ uses: astral-sh/setup-uv@v10.3.0
17
17
  with:
18
18
  enable-cache: true
19
19
 
20
20
  - name: Setup Python
21
- uses: actions/setup-python@v6
21
+ uses: actions/setup-python@v7
22
22
  with:
23
23
  python-version: "3.13"
24
24
  architecture: x64
@@ -51,7 +51,7 @@ jobs:
51
51
  echo "Tag $VERSION does not follow v<version> naming scheme"
52
52
  exit 1
53
53
  fi
54
- - uses: actions/checkout@v6
54
+ - uses: actions/checkout@v7
55
55
  - name: Generate release body
56
56
  run: |
57
57
  sed "s/:VERSION/$VERSION/g" < .github/release-template.md > release.md
@@ -59,7 +59,7 @@ jobs:
59
59
  env:
60
60
  VERSION: ${{ steps.getrelease.outputs.version }}
61
61
  - name: Upload release body
62
- uses: actions/upload-artifact@v4
62
+ uses: actions/upload-artifact@v7
63
63
  with:
64
64
  name: release-body
65
65
  path: release.md
@@ -75,12 +75,12 @@ jobs:
75
75
  - windows-latest
76
76
  - macos-14
77
77
  steps:
78
- - uses: actions/checkout@v6
78
+ - uses: actions/checkout@v7
79
79
  - name: Setup Python
80
- uses: actions/setup-python@v6
80
+ uses: actions/setup-python@v7
81
81
  - name: Build wheels
82
- uses: pypa/cibuildwheel@v3.3.0
83
- - uses: actions/upload-artifact@v4
82
+ uses: pypa/cibuildwheel@v4.3.2
83
+ - uses: actions/upload-artifact@v7
84
84
  with:
85
85
  name: wheels-${{ matrix.os }}-${{ strategy.job-index }}
86
86
  path: ./wheelhouse/*.whl
@@ -88,16 +88,16 @@ jobs:
88
88
  runs-on: ubuntu-latest
89
89
  needs: [extract-params]
90
90
  steps:
91
- - uses: actions/checkout@v6
91
+ - uses: actions/checkout@v7
92
92
  - name: Setup Python
93
- uses: actions/setup-python@v6
93
+ uses: actions/setup-python@v7
94
94
  - name: Install uv
95
- uses: astral-sh/setup-uv@v7
95
+ uses: astral-sh/setup-uv@v10.3.0
96
96
  with:
97
97
  enable-cache: true
98
98
  - name: Build source distribution
99
99
  run: uv build --sdist
100
- - uses: actions/upload-artifact@v4
100
+ - uses: actions/upload-artifact@v7
101
101
  with:
102
102
  name: sdist
103
103
  path: ./dist/*.tar.gz
@@ -113,18 +113,18 @@ jobs:
113
113
  contents: write
114
114
  steps:
115
115
  - name: Download wheels
116
- uses: actions/download-artifact@v4
116
+ uses: actions/download-artifact@v8
117
117
  with:
118
118
  pattern: wheels-*
119
119
  path: dist/
120
120
  merge-multiple: 'true'
121
121
  - name: Download source distribution
122
- uses: actions/download-artifact@v4
122
+ uses: actions/download-artifact@v8
123
123
  with:
124
124
  name: sdist
125
125
  path: dist/
126
126
  - name: Download release body
127
- uses: actions/download-artifact@v4
127
+ uses: actions/download-artifact@v8
128
128
  with:
129
129
  name: release-body
130
130
  path: release-body
@@ -134,7 +134,7 @@ jobs:
134
134
  repository-url: ${{ vars.REPOSITORY_URL }}
135
135
  - name: Create GitHub release
136
136
  if: needs.extract-params.outputs.publish-env == 'pypi' && startsWith(github.ref, 'refs/tags/')
137
- uses: softprops/action-gh-release@v2
137
+ uses: softprops/action-gh-release@v3
138
138
  with:
139
139
  files: |
140
140
  dist/*.whl
@@ -27,6 +27,7 @@ jobs:
27
27
  - "3.12"
28
28
  - "3.13"
29
29
  - "3.14"
30
+ - "3.15"
30
31
  pkcs11-platform:
31
32
  - softhsm
32
33
  - opencryptoki
@@ -39,7 +40,7 @@ jobs:
39
40
  os: macos-14
40
41
  steps:
41
42
  - name: Acquire sources
42
- uses: actions/checkout@v6
43
+ uses: actions/checkout@v7
43
44
  - uses: ./.github/actions/test-setup
44
45
  id: setup
45
46
  with:
@@ -65,9 +66,10 @@ jobs:
65
66
  - "3.12"
66
67
  - "3.13"
67
68
  - "3.14"
69
+ - "3.15"
68
70
  steps:
69
71
  - name: Acquire sources
70
- uses: actions/checkout@v6
72
+ uses: actions/checkout@v7
71
73
  - uses: ./.github/actions/test-setup
72
74
  id: setup
73
75
  with:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-pkcs11
3
- Version: 0.9.5
3
+ Version: 0.10.1
4
4
  Summary: PKCS#11 support for Python
5
5
  Author-email: Andrey Kislyuk <kislyuk@gmail.com>, Danielle Madeley <danielle@madeley.id.au>
6
6
  Maintainer-email: Andrey Kislyuk <kislyuk@gmail.com>
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
19
20
  Classifier: Topic :: Security :: Cryptography
20
21
  Requires-Python: >=3.10
21
22
  Description-Content-Type: text/x-rst
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
  #
4
3
  # Python PKCS#11 documentation build configuration file, created by
5
4
  # sphinx-quickstart on Sat May 20 11:47:34 2017.
@@ -38,6 +38,7 @@ static P11_HANDLE* p11_open(PyObject *path_str) {
38
38
  result = (P11_HANDLE*) PyMem_Malloc(sizeof(P11_HANDLE));
39
39
  result->lib_handle = handle;
40
40
  result->get_function_list_ptr = ptr;
41
+ result->get_interface_ptr = GetProcAddress(handle, "C_GetInterface");
41
42
  }
42
43
  }
43
44
  return result;
@@ -85,6 +86,7 @@ static P11_HANDLE* p11_open(PyObject *path_str) {
85
86
  result = (P11_HANDLE*) PyMem_Malloc(sizeof(P11_HANDLE));
86
87
  result->lib_handle = handle;
87
88
  result->get_function_list_ptr = ptr;
89
+ result->get_interface_ptr = dlsym(handle, "C_GetInterface");
88
90
  }
89
91
  }
90
92
  return result;
@@ -12,7 +12,8 @@ typedef void *LIB_HANDLE;
12
12
  #ifndef P11_HANDLE
13
13
  typedef struct P11_HANDLE {
14
14
  LIB_HANDLE lib_handle;
15
- void * get_function_list_ptr;
15
+ void *get_function_list_ptr;
16
+ void *get_interface_ptr; /* C_GetInterface direct export; NULL for v2.0 libs */
16
17
  } P11_HANDLE;
17
18
  #endif
18
19
 
@@ -24,7 +24,6 @@ def lib(so: str) -> _lib_type:
24
24
  Wrap the main library call coming from Cython with a preemptive
25
25
  dynamic loading.
26
26
  """
27
- global _loaded
28
27
 
29
28
  try:
30
29
  _lib = _loaded[so]
@@ -43,7 +42,6 @@ def lib(so: str) -> _lib_type:
43
42
 
44
43
 
45
44
  def unload(so: str) -> None:
46
- global _loaded
47
45
  try:
48
46
  loaded_lib = _loaded[so]
49
47
  except KeyError:
@@ -280,6 +280,11 @@ cdef extern from '../extern/cryptoki.h':
280
280
  CK_ULONG ulContextDataLen
281
281
  CK_BYTE *pContextData
282
282
 
283
+ ctypedef struct CK_INTERFACE:
284
+ CK_UTF8CHAR *pInterfaceName
285
+ void *pFunctionList
286
+ CK_FLAGS flags
287
+
283
288
  cdef struct CK_FUNCTION_LIST:
284
289
  CK_VERSION version
285
290
  ## pointers to library functions are stored here
@@ -600,10 +605,170 @@ cdef extern from '../extern/cryptoki.h':
600
605
  CK_SLOT_ID *slot,
601
606
  void *pRserved) nogil
602
607
 
608
+
609
+ cdef struct CK_FUNCTION_LIST_3_0:
610
+ CK_RV C_GetInterfaceList(CK_INTERFACE *pInterfacesList,
611
+ CK_ULONG *pulCount) nogil
612
+
613
+ CK_RV C_GetInterface(CK_UTF8CHAR *pInterfaceName,
614
+ CK_VERSION *pVersion,
615
+ CK_INTERFACE **ppInterface,
616
+ CK_FLAGS flags) nogil
617
+
618
+ CK_RV C_LoginUser(CK_SESSION_HANDLE hSession,
619
+ CK_USER_TYPE userType,
620
+ CK_UTF8CHAR *pPin,
621
+ CK_ULONG ulPinLen,
622
+ CK_UTF8CHAR *pUsername,
623
+ CK_ULONG ulUsernameLen) nogil
624
+
625
+ CK_RV C_SessionCancel(CK_SESSION_HANDLE hSession,
626
+ CK_FLAGS flags) nogil
627
+
628
+ CK_RV C_MessageEncryptInit(CK_SESSION_HANDLE hSession,
629
+ CK_MECHANISM *pMechanism,
630
+ CK_OBJECT_HANDLE hKey) nogil
631
+
632
+ CK_RV C_EncryptMessage(CK_SESSION_HANDLE hSession,
633
+ void *pParameter,
634
+ CK_ULONG ulParameterLen,
635
+ CK_BYTE *pAssociatedData,
636
+ CK_ULONG ulAssociatedDataLen,
637
+ CK_BYTE *pPlaintext,
638
+ CK_ULONG ulPlaintextLen,
639
+ CK_BYTE *pCiphertext,
640
+ CK_ULONG *pulCiphertextLen) nogil
641
+
642
+ CK_RV C_EncryptMessageBegin(CK_SESSION_HANDLE hSession,
643
+ void *pParameter,
644
+ CK_ULONG ulParameterLen,
645
+ CK_BYTE *pAssociatedData,
646
+ CK_ULONG ulAssociatedDataLen) nogil
647
+
648
+ CK_RV C_EncryptMessageNext(CK_SESSION_HANDLE hSession,
649
+ void *pParameter,
650
+ CK_ULONG ulParameterLen,
651
+ CK_BYTE *pPlaintextPart,
652
+ CK_ULONG ulPlaintextPartLen,
653
+ CK_BYTE *pCiphertextPart,
654
+ CK_ULONG *pulCiphertextPartLen,
655
+ CK_FLAGS flags) nogil
656
+
657
+ CK_RV C_MessageEncryptFinal(CK_SESSION_HANDLE hSession) nogil
658
+
659
+ CK_RV C_MessageDecryptInit(CK_SESSION_HANDLE hSession,
660
+ CK_MECHANISM *pMechanism,
661
+ CK_OBJECT_HANDLE hKey) nogil
662
+
663
+ CK_RV C_DecryptMessage(CK_SESSION_HANDLE hSession,
664
+ void *pParameter,
665
+ CK_ULONG ulParameterLen,
666
+ CK_BYTE *pAssociatedData,
667
+ CK_ULONG ulAssociatedDataLen,
668
+ CK_BYTE *pCiphertext,
669
+ CK_ULONG ulCiphertextLen,
670
+ CK_BYTE *pPlaintext,
671
+ CK_ULONG *pulPlaintextLen) nogil
672
+
673
+ CK_RV C_DecryptMessageBegin(CK_SESSION_HANDLE hSession,
674
+ void *pParameter,
675
+ CK_ULONG ulParameterLen,
676
+ CK_BYTE *pAssociatedData,
677
+ CK_ULONG ulAssociatedDataLen) nogil
678
+
679
+ CK_RV C_DecryptMessageNext(CK_SESSION_HANDLE hSession,
680
+ void *pParameter,
681
+ CK_ULONG ulParameterLen,
682
+ CK_BYTE *pCiphertextPart,
683
+ CK_ULONG ulCiphertextPartLen,
684
+
685
+ CK_ULONG *pulPlaintextPartLen,
686
+ CK_FLAGS flags) nogil
687
+
688
+ CK_RV C_MessageDecryptFinal(CK_SESSION_HANDLE hSession) nogil
689
+
690
+ CK_RV C_MessageSignInit(CK_SESSION_HANDLE hSession,
691
+ CK_MECHANISM *pMechanism,
692
+ CK_OBJECT_HANDLE hKey) nogil
693
+
694
+ CK_RV C_SignMessage(CK_SESSION_HANDLE hSession,
695
+ void *pParameter,
696
+ CK_ULONG ulParameterLen,
697
+ CK_BYTE *pData,
698
+ CK_ULONG ulDataLen,
699
+ CK_BYTE *pSignature,
700
+ CK_ULONG *pulSignatureLen) nogil
701
+
702
+ CK_RV C_SignMessageBegin(CK_SESSION_HANDLE hSession,
703
+ void *pParameter,
704
+ CK_ULONG ulParameterLen) nogil
705
+
706
+ CK_RV C_SignMessageNext(CK_SESSION_HANDLE hSession,
707
+ void *pParameter,
708
+ CK_ULONG ulParameterLen,
709
+ CK_BYTE *pData,
710
+ CK_ULONG ulDataLen,
711
+ CK_BYTE *pSignature,
712
+ CK_ULONG *pulSignatureLen) nogil
713
+
714
+ CK_RV C_MessageSignFinal(CK_SESSION_HANDLE hSession) nogil
715
+
716
+ CK_RV C_MessageVerifyInit(CK_SESSION_HANDLE hSession,
717
+ CK_MECHANISM *pMechanism,
718
+ CK_OBJECT_HANDLE hKey) nogil
719
+
720
+ CK_RV C_VerifyMessage(CK_SESSION_HANDLE hSession,
721
+ void *pParameter,
722
+ CK_ULONG ulParameterLen,
723
+ CK_BYTE *pData,
724
+ CK_ULONG ulDataLen,
725
+ CK_BYTE *pSignature,
726
+ CK_ULONG ulSignatureLen) nogil
727
+
728
+ CK_RV C_VerifyMessageBegin(CK_SESSION_HANDLE hSession,
729
+ void *pParameter,
730
+ CK_ULONG ulParameterLen) nogil
731
+
732
+ CK_RV C_VerifyMessageNext(CK_SESSION_HANDLE hSession,
733
+ void *pParameter,
734
+ CK_ULONG ulParameterLen,
735
+ CK_BYTE *pData,
736
+ CK_ULONG ulDataLen,
737
+ CK_BYTE *pSignature,
738
+ CK_ULONG ulSignatureLen) nogil
739
+
740
+ CK_RV C_MessageVerifyFinal(CK_SESSION_HANDLE hSession) nogil
741
+
742
+
743
+ cdef struct CK_FUNCTION_LIST_3_2:
744
+ CK_RV C_EncapsulateKey(CK_SESSION_HANDLE session,
745
+ CK_MECHANISM *mechanism,
746
+ CK_OBJECT_HANDLE public_key,
747
+ CK_ATTRIBUTE *template,
748
+ CK_ULONG count,
749
+ CK_BYTE *ciphertext,
750
+ CK_ULONG *ciphertext_len,
751
+ CK_OBJECT_HANDLE *key) nogil
752
+ CK_RV C_DecapsulateKey(CK_SESSION_HANDLE session,
753
+ CK_MECHANISM *mechanism,
754
+ CK_OBJECT_HANDLE private_key,
755
+ CK_ATTRIBUTE *template,
756
+ CK_ULONG count,
757
+ CK_BYTE *ciphertext,
758
+ CK_ULONG ciphertext_len,
759
+ CK_OBJECT_HANDLE *key) nogil
760
+
603
761
  # The only external API call that must be defined in a PKCS#11 library
604
762
  # All other APIs are taken from the CK_FUNCTION_LIST table
605
763
  ctypedef CK_RV (*C_GetFunctionList_ptr) (CK_FUNCTION_LIST **) nogil
606
764
 
765
+ ctypedef CK_RV (*C_GetInterface_ptr)(
766
+ CK_UTF8CHAR *pInterfaceName,
767
+ CK_VERSION *pVersion,
768
+ CK_INTERFACE **ppInterface,
769
+ CK_FLAGS flags
770
+ ) nogil
771
+
607
772
  ctypedef CK_RV (*KeyOperationInit) (
608
773
  CK_SESSION_HANDLE session,
609
774
  CK_MECHANISM *mechanism,
@@ -1,8 +1,7 @@
1
1
  """Type stubs for the _pkcs11 Cython extension module."""
2
2
 
3
- from __future__ import annotations
4
-
5
- from typing import Any, Iterator
3
+ from collections.abc import Iterator
4
+ from typing import Any
6
5
 
7
6
  from pkcs11.types import Slot, Token
8
7
 
@@ -34,5 +33,3 @@ class lib:
34
33
  ) -> Iterator[Token]: ...
35
34
  def get_token(self, **kwargs: Any) -> Token: ...
36
35
  def wait_for_slot_event(self, blocking: bool = True) -> Slot: ...
37
- def __str__(self) -> str: ...
38
- def __repr__(self) -> str: ...