package main import ( os encoding/pem crypto/x509 crypto/rsa crypto/sha256 crypto/rand crypto fmt ) //生成RSA私钥和公钥,保存到文件中 func GenerateRSAKey(bits int){ //GenerateKey函数使用随机数据生成器random生成一对具有指定字位数的RSA密钥 //Reader是一个全局、共享的密码用强随机数生成器 privateKey, err := rsa.GenerateKey(rand.Reader