summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNoƩ Lopez <noelopez@free.fr>2026-03-12 19:37:33 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-03-22 09:37:42 +0100
commit75fb39109037ade87fa7a2af9f448798c507014b (patch)
treeaec8510d2d6701a516d5bca68cef1e1b848f1ef0 /gnu
parentefb6a95110943fc4dcf45c25d9df49f1eff8c5e6 (diff)
gnu: Add python-pykcs11.
* gnu/packages/python-crypto.scm (python-pykcs11): New variable. Change-Id: If8c66d9ceb50127b56658d75886fe57dd8879bef Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-crypto.scm46
1 files changed, 46 insertions, 0 deletions
diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index c0143835344..2adeb295c38 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -61,6 +61,7 @@
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages nss)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages check)
#:use-module (gnu packages crypto)
#:use-module (gnu packages kerberos)
@@ -78,6 +79,7 @@
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages rust)
#:use-module (gnu packages rust-apps)
+ #:use-module (gnu packages security-token)
#:use-module (gnu packages swig)
#:use-module (gnu packages time)
#:use-module (gnu packages tls)
@@ -1198,6 +1200,50 @@ supports KDBX3 and KDBX4.")
;; indicates GPL3.
(license license:gpl3+)))
+(define-public python-pykcs11
+ (package
+ (name "python-pykcs11")
+ (version "1.5.18")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/LudovicRousseau/PyKCS11")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1r1xn5lfnrnl62prd0a5ckmc8mggn6nqcnhsj9zg0vhf00ffs4gg"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(begin
+ (use-modules (ice-9 textual-ports))
+ (modify-phases %standard-phases
+ (add-before 'check 'fix-test-run
+ (lambda* (#:key inputs #:allow-other-keys)
+ (delete-file-recursively "PyKCS11")
+ (setenv "PYKCS11LIB" (search-input-file inputs "/lib/softhsm/libsofthsm2.so"))))
+ (add-before 'check 'setup-softhsm
+ (lambda _
+ (call-with-output-file "softhsm2.conf"
+ (lambda (port)
+ (put-string port "directories.tokendir = /tmp/tokens/")))
+ (setenv "SOFTHSM2_CONF" "softhsm2.conf")
+ (mkdir "/tmp/tokens")
+ (invoke "test/reset_softHSM.sh")))))))
+ (native-inputs
+ (list bash-minimal
+ python-asn1crypto
+ python-setuptools
+ python-pytest
+ softhsm
+ swig))
+ (home-page "https://github.com/LudovicRousseau/PyKCS11")
+ (synopsis "PKCS#11 wrapper for Python")
+ (description "This package provides a complete PKCS#11 wrapper for Python.")
+ (license license:gpl3)))
+
(define-public python-pylibscrypt
(package
(name "python-pylibscrypt")