GmSSL-Python icon indicating copy to clipboard operation
GmSSL-Python copied to clipboard

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

Open Jinkeee opened this issue 1 year ago • 11 comments

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

Jinkeee avatar Nov 22 '23 04:11 Jinkeee

同问

sqs404 avatar Dec 31 '23 11:12 sqs404

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

KKKGod avatar Jan 02 '24 04:01 KKKGod

也是遇到了这个问题,请问楼主解决了吗? 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

monkeyyang avatar Mar 05 '24 13:03 monkeyyang

也是遇到了这个问题,请问楼主解决了吗? 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 avatar Mar 26 '24 08:03 99tyw

同问

yujingyue9166 avatar Mar 27 '24 06:03 yujingyue9166

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

j-z10 avatar Mar 28 '24 02:03 j-z10

感谢您的回复! 遇到了一个新的问题,在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.

monkeyyang avatar Mar 28 '24 05:03 monkeyyang

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

Zhanghanhan1 avatar Mar 29 '24 09:03 Zhanghanhan1

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

j-z10 avatar Mar 30 '24 07:03 j-z10

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

FloocX avatar Mar 31 '24 09:03 FloocX

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

FloocX avatar Apr 01 '24 02:04 FloocX