Bohr1005 / xcrypto

quant,trading system,crypto,async
MIT License
280 stars 81 forks source link

.pem文件解码出现问题 #10

Open armandtarga opened 1 month ago

armandtarga commented 1 month ago

您好,在使用过程中,发现无法对.pem文件进行解码。 报错如下: Error: error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:102:No supported data to decode. Input type: PEM, error:0680007B:asn1 encoding routines:ASN1_get_object:header too long:crypto/asn1/asn1_lib.c:105:, error:06800066:asn1 encoding routines:asn1_check_tlen:bad object header:crypto/asn1/tasn_dec.c:1184:, error:0688010A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:crypto/asn1/tasn_dec.c:349:Type=PKCS8_PRIV_KEY_INFO

我的private_key.pem内部是: -----BEGIN PRIVATE KEY----- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -----END PRIVATE KEY-----

请问您之前有碰到这样的问题吗?我试了几个gpt建议的方法,还是无法解决。

Bohr1005 commented 1 month ago

确认正确填写你的私钥了吗

armandtarga commented 1 month ago

私钥没问题。 我在终端check文件的时候: openssl pkey -in private_key.pem -check 返回的结果是: Could not find private key of key from private_key.pem

Bohr1005 commented 1 month ago

看着像是私钥不对啊,正确的私钥这一句命令会返回key is valid。项目里的private_key.pem是我自己的私钥,被我清空了,需要替换成你自己的私钥

10ucapital commented 1 month ago

我的流程是重新生成一组私钥-去BN新建api,然后把API粘贴进JSON。LZ可以检查一下流程?