//生成公钥、私钥文件 func GenRsaKey(bits int) error { // 生成私钥文件 privateKey, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { return err } derStream := x509.MarshalPKCS1PrivateKey(privateKey) block := &pem.Block{ Type: RSA PRIVATE KEY, Bytes: derStream, } file, err := os.Create(./pem