Tongsuo-Project / Tongsuo

铜锁/Tongsuo is a Modern Cryptographic Primitives and Protocols Library
https://www.tongsuo.net
Apache License 2.0
1.16k stars 186 forks source link

sm2双证书的EC格式签名私钥,转为pkcs#8格式报错 #664

Open Smiliny opened 1 month ago

Smiliny commented 1 month ago

此国密站点双证书为四川CA所颁发。 国密的签名EC格式私钥开头都带了如下参数:

ASN1 OID: sm2p256v1 NIST CURVE: SM2 -----BEGIN EC PARAMETERS----- BggqgRzPVQGCLQ== -----END EC PARAMETERS-----

用openssl转换格式到pkcs8时报错,用tongsuo转换时也报了一样的错。 openssl pkcs8 -topk8 -in sign.key -out enc_pkcs8.pem -nocrypt

Could not read key from sign.key 4087A30EDC7F0000:error:1608010C:STORE routines:ossl_store_handle_load_result:unsupported:../crypto/store/store_result.c:151: 4087A30EDC7F0000:error:1608010C:STORE routines:ossl_store_handle_load_result:unsupported:../crypto/store/store_result.c:151: 4087A30EDC7F0000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:../crypto/encode_decode/decoder_lib.c:101:No supported data to decode.

请问用tongsuo怎样才能转换国密的EC格式密钥?