Python CFCA signature

recently, the project encountered a docking problem ~ using CFCA encryption signature
because the online python seldom asked my brother to lead the way

Apr.20,2022

solved the problem here mark
because the pfx certificate is used for signature,
1. First use openssl to extract the key pair from the pfx certificate (password is required)
openssl pkcs12-in xxx.pfx-nocerts-nodes-out private.key
2. Extract the private key from the key pair
openssl rsa-in private.key-out private.pem
3.python Code Private key signature
message = "xxxxx"-sharp signature string
with open ('/ path/private.pem', 'r') as f:

privkey = rsa.PrivateKey.load_pkcs1(f.read().encode())

base64.b64encode (rsa.sign (message.encode (), privkey, 'SHA-256'))

Menu