程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

Digital signature to PDF file - pkcs11.dll not detected from the system

发布于2025-01-04 12:50     阅读(966)     评论(0)     点赞(13)     收藏(0)


I want to sign a PDF file using a digital signature from a USB token (containing the private and public keys). When I try to achieve this using PKCS11.dll, the system detects an error and throws a 'module could not be found' error.

C:\Windows\System32\pkcs11.dll
Error loading PKCS#11 library: Cannot open library at C:\Windows\System32\pkcs11.dll: The specified module could not be found.

My Code:

import os
import pkcs11

# Path to the PKCS#11 library (update this path accordingly)
pkcs11_lib_path = r'C:\Windows\System32\pkcs11.dll'  # or SysWOW64 for 32-bit
print(pkcs11_lib_path)
# Initialize the PKCS#11 library
try:
    lib = pkcs11.lib(pkcs11_lib_path)
except Exception as e:
    print(f"Error loading PKCS#11 library: {e}")
    exit(1)

I tried my code block above mentioned


解决方案


The answer is in the error message The specified module could not be found

You must supply a full path for your token's PKCS#11 module provided by your hardware manufacturer.

The library located in system32 / SysWOW64don't need to supply path to them. Module name is enough.

Based on my experience there are no token manufacturers that call they library simply as a pkcs11.dll.

rtPKCS11.dll, eTPKCS11.dll or etc is the more realistic names.



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:https://www.pythonheidong.com/blog/article/2046709/4992ebe67c470f43181e/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

13 0
收藏该文
已收藏

评论内容:(最多支持255个字符)