后台,生成密钥对rsa加密去掉换行

This commit is contained in:
wolter 2024-08-12 13:44:11 +08:00
parent e1bd366989
commit 05b0663c21
1 changed files with 2 additions and 0 deletions

View File

@ -154,7 +154,9 @@ func GenerateKey() (string, string, error) {
pubPem := pem.EncodeToMemory(pubBlock)
pri := strings.Replace(string(privPem), "-----BEGIN RSA PRIVATE KEY-----\n", "", -1)
pri = strings.Replace(pri, "\n-----END RSA PRIVATE KEY-----\n", "", -1)
pri = strings.Replace(pri, "\n", "", -1)
pub := strings.Replace(string(pubPem), "-----BEGIN PUBLIC KEY-----\n", "", -1)
pub = strings.Replace(pub, "\n-----END PUBLIC KEY-----\n", "", -1)
pub = strings.Replace(pub, "\n", "", -1)
return pub, pri, nil
}