Why are the RSA signatures I generate with openssl and golang different?

后端 未结 3 1123
猫巷女王i
猫巷女王i 2021-01-16 02:21

I use openssl command to sign the message \"Test.\", output with hexdump

# echo \"Test.\" | openssl rsautl -inkey privite.key -sign -hexdump
0000 - 09 1b ce          


        
3条回答
  •  無奈伤痛
    2021-01-16 02:30

    This is a very useful link.

    // Sign secret with rsa with PKCS 1.5 as the padding algorithm
    // The result should be exactly same as "openssl rsautl -sign -inkey "YOUR_RSA_PRIVATE_KEY" -in "YOUR_PLAIN_TEXT""
    signer, err := rsa.SignPKCS1v15(rand.Reader, rsaPrivateKey.(*rsa.PrivateKey), crypto.Hash(0), []byte(message))
    

    https://github.com/bitmartexchange/bitmart-go-api/blob/master/bm_client.go

提交回复
热议问题