fzlee/alipay

OpenSSL.crypto.Error: [('PEM routines', 'get_name', 'no start line')]

sharp opened this issue · 1 comments

sharp commented

Describe the problem
按照文档生成的pem openssl genrsa -out test.pem 2048
alipay加载这个文件的时候报错, 我自己定位到是openssl报的错误,麻烦帮看一下

dc_alipay = DCAliPay(
        appid="00000000000000",
        app_notify_url="http://test..com/alipay/notify",
        app_private_key_string=app_private_key_string,
        app_public_key_cert_string=app_public_key_string,
        alipay_public_key_cert_string=alipay_public_key_cert_string,
        alipay_root_cert_string=alipay_root_cert_string,
        debug=True,
        sign_type='RSA2',
    )

Environment
OS version: macOS 10.1.5.7
Python version:3.6.9
Alipay version: 3.0.1

To reproduce
Code snippets:

app_public_key_string = open('test.pem').read()
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, app_public_key_string)

**Expected behavior **
截屏2021-08-01 下午7 49 52

sharp commented

问题解决了 这个证书(app_public_key_cert_string)是从支付宝上下载的