go语言实现楕圆曲线生成公私钥
package main import ( "bytes" "compress/gzip" "crypto/ecdsa" "crypto/elliptic" "crypto/md5" "crypto/rand" "encoding/hex" "errors" "fmt" "math/big" "prlife/tool" "strings" ) //楕圆曲线算法生成公钥, func main(){ //测试根据随机key及楕圆曲线生成私钥和公钥 privateKey,publicKey:=newKeyPair() fmt.Printf("私钥:%x\n",privateKey.D.Bytes()) fmt.Printf("公钥:%x\n",publicKey) //16进制表示 //根据指定key生成私钥和公钥 randKey := "20180619zafes20180619zafes20180619zafessss" //randKey:=tool.GetRandomString(40) prk, puk, err := getEcdsaKey(randKey) if err != nil { fmt.Println(err) } publicKey1 := append(puk.X.Bytes(), puk.Y.Bytes()...) fmt.Printf("私钥为:%x