后台,生成密钥对rsa加密去掉换行
This commit is contained in:
parent
e1bd366989
commit
05b0663c21
|
@ -154,7 +154,9 @@ func GenerateKey() (string, string, error) {
|
||||||
pubPem := pem.EncodeToMemory(pubBlock)
|
pubPem := pem.EncodeToMemory(pubBlock)
|
||||||
pri := strings.Replace(string(privPem), "-----BEGIN RSA PRIVATE KEY-----\n", "", -1)
|
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-----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(string(pubPem), "-----BEGIN PUBLIC KEY-----\n", "", -1)
|
||||||
pub = strings.Replace(pub, "\n-----END PUBLIC KEY-----\n", "", -1)
|
pub = strings.Replace(pub, "\n-----END PUBLIC KEY-----\n", "", -1)
|
||||||
|
pub = strings.Replace(pub, "\n", "", -1)
|
||||||
return pub, pri, nil
|
return pub, pri, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue