zhangzengfei
2019-11-21 fd4a6bc9794c3138b322753c8ce1b628c7b3e86b
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,