gmssl / gmssl-python Goto Github PK
View Code? Open in Web Editor NEWPython binding to the GmSSL library
Home Page: https://gmssl.github.io/GmSSL-Python/
License: Apache License 2.0
Python binding to the GmSSL library
Home Page: https://gmssl.github.io/GmSSL-Python/
License: Apache License 2.0
已经安装gmssl,cmd可使用,但写代码时仍提示找不到动态库
Is there any plan to support sm9? if not, Can I contribute Pull requests?
开发者您好,我电脑win11 64位系统,python版本是3.12.0
已经正确安装gmssl和gmssl-python如下:
>>> import gmssl
>>> gmssl.GMSSL_PYTHON_VERSION
'2.2.2'
>>> gmssl.GMSSL_LIBRARY_VERSION
'GmSSL 3.1.1 Dev'
我在测试example文件夹下的例程时,sm3.py和sm4.py运行正常,sm2_key.py运行时报错如下:
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\gmssl.py", line 436, in export_encrypted_private_key_info_pem
if gmssl.sm2_private_key_info_encrypt_to_pem(byref(self), c_char_p(passwd), c_void_p(fp)) != 1:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: exception: access violation writing 0x0000000000000024
在网上搜索该错误一直没找到解决办法,特在此提问,烦请进行解答,感谢
Traceback (most recent call last):
File "/home/bc/sm3_pbkdf2_demo.py", line 18, in
key = sm3_pbkdf2(passwd, salt, iterator, keylen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bc/Public/anaconda3/lib/python3.11/site-packages/gmssl.py", line 136, in sm3_pbkdf2
if gmssl.pbkdf2_hmac_sm3_genkey(c_char_p(passwd), c_size_t(len(passwd)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bc/Public/anaconda3/lib/python3.11/ctypes/init.py", line 389, in getattr
func = self.getitem(name)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/bc/Public/anaconda3/lib/python3.11/ctypes/init.py", line 394, in getitem
func = self._FuncPtr((name_or_ordinal, self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: /usr/local/lib/libgmssl.so.3: undefined symbol: pbkdf2_hmac_sm3_genkey
==========================================================================
系统信息:
❯ python3 --version
Python 3.11.5
❯ uname -a
Linux Ubuntu-2404-LTS 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 02:32:42 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
❯ gcc --version
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
❯ g++ --version
g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Traceback (most recent call last):
File "C:\Users\sunqi\Desktop\GmSSL-Python-main\demo.py", line 2, in
from gmssl import *
File "C:\Users\sunqi\Desktop\GmSSL-Python-main\gmssl.py", line 18, in
gmssl = cdll.LoadLibrary(libgmssl)
File "C:\Users\sunqi\anaconda3\envs\win32py36sm9\lib\ctypes_init_.py", line 426, in LoadLibrary
return self.dlltype(name)
File "C:\Users\sunqi\anaconda3\envs\win32py36sm9\lib\ctypes_init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
import gmssl
Traceback (most recent call last):
File "", line 1, in
File "E:\crypto_lesson_java\PyQt_progress\GmSSL-Python-main\gmssl.py", line 18, in
gmssl = cdll.LoadLibrary(find_library("gmssl"))
File "E:\python3\lib\ctypes_init_.py", line 452, in LoadLibrary
return self.dlltype(name)
File "E:\python3\lib\ctypes_init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 不是有效的 Win32 应用程序。
rt.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.