GmSSL / GmSSL-Python

Python binding to the GmSSL library
https://gmssl.github.io/GmSSL-Python/
Apache License 2.0
68 stars 11 forks source link

python下导出主密钥报OSError: exception: access violation writing 0x0000000000000024 #9

Open Jinkeee opened 10 months ago

Jinkeee commented 10 months ago

python下导出主密钥报OSError: exception: access violation writing 0x0000000000000024‘; image 请问该如何解决?

sqs404 commented 9 months ago

同问

KKKGod commented 9 months ago

同问,sm9 sm2 的test都是这个类似问题

monkeyyang commented 7 months ago

也是遇到了这个问题,请问楼主解决了吗? gmssl.sm2_private_key_info_decrypt_from_pem(byref(self), c_char_p(passwd), c_void_p(fp)) != 1: OSError: exception: access violation writing 0x0000000000000024

99tyw commented 6 months ago

也是遇到了这个问题,请问楼主解决了吗? gmssl.sm2_private_key_info_decrypt_from_pem(byref(self), c_char_p(passwd), c_void_p(fp)) != 1: OSError: exception: access violation writing 0x0000000000000024

yujingyue9166 commented 6 months ago

同问

j-z10 commented 6 months ago

you guys should install GmSSLv3.1.1 instead of GmSSL@master

git clone -b 'v3.1.1' --depth 1 https://github.com/guanzhi/GmSSL.git
cd GmSSL && mkdir build && cd build && cmake ..
make && make test && sudo make install
sudo ldconfig

# check it's version. should be GmSSL 3.1.1
gmssl version
monkeyyang commented 6 months ago

感谢您的回复! 遇到了一个新的问题,在Windows下Visual Studio命令提示符下执行:

mkdir build cd build cmake .. -G "NMake Makefiles" nmake D:\wwwroot\GmSSL\build>nmake

报以下错误,请问如何解决呢?

[ 1%] Building C object CMakeFiles/gmssl.dir/src/tls.c.obj tls.c D:\wwwroot\GmSSL\src\tls.c(2323): warning C4013: “fcntl”未定义;假设外部返回 int D:\wwwroot\GmSSL\src\tls.c(2323): error C2065: “F_GETFL”: 未声明的标识符 D:\wwwroot\GmSSL\src\tls.c(2328): error C2065: “O_NONBLOCK”: 未声明的标识符 NMAKE : fatal error U1077: “"C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\gmssl.dir\src\tls.c.obj.d --working-dir=D:\wwwroot\GmSSL\build --filter-prefix="注意: 包含文件: " -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx86\x86\cl.exe @C:\Users\YANGYA~1\AppData\Local\Temp\nm7200.tmp”: 返回代 码“0x2” Stop. NMAKE : fatal error U1077: “"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\nmake.exe" -s -f CMakeFiles\gmssl.dir\build.make /nologo -SL CMakeFiles\gmssl.dir\build”: 返回代 码“0x2” Stop. NMAKE : fatal error U1077: “"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\nmake.exe" -s -f CMakeFiles\Makefile2 /nologo -S all”: 返回代码“0x2” Stop.

Zhanghanhan1 commented 6 months ago

同问 已安装gmssl3.1.1和gmssl-python

j-z10 commented 6 months ago

you guys should install GmSSLv3.1.1 instead of GmSSL@master

git clone -b 'v3.1.1' --depth 1 https://github.com/guanzhi/GmSSL.git
cd GmSSL && mkdir build && cd build && cmake ..
make && make test && sudo make install
sudo ldconfig

# check it's version. should be GmSSL 3.1.1
gmssl version

看起来是windows下 pem_write 和 pem_read 导致的问题,我这个PR针对windows做了临时处理,把这一步放在python里面执行 你们可以参考一下 https://github.com/j-z10/pygmssl/pull/9

wudi666ss commented 6 months ago

这不是一个包吧,j-z10师傅

wudi666ss commented 6 months ago

j-z10师傅给出的代码是pygmssl的,我试了一下,是可以用的,感谢师傅