zhangzengfei
2020-03-18 66c18a0d59c71a672318b86f0a57e4ea44ca4fe0
rsa.go
@@ -28,13 +28,13 @@
   prikey *rsa.PrivateKey //私钥
}
func GetRsaKey() error {
func GetRsaKey(prefix string) error {
   privateKey, err := rsa.GenerateKey(rand.Reader, 4096)
   if err != nil {
      return err
   }
   x509PrivateKey := x509.MarshalPKCS1PrivateKey(privateKey)
   privateFile, err := os.Create(privateFileName)
   privateFile, err := os.Create(prefix + "-" + privateFileName)
   if err != nil {
      return err
   }
@@ -52,7 +52,7 @@
   if err != nil {
      panic(err)
   }
   publicFile, _ := os.Create(publicFileName)
   publicFile, _ := os.Create(prefix + "-" + publicFileName)
   defer publicFile.Close()
   publicBlock := pem.Block{
      Type:  publicKeyPrefix,