mirror of
https://github.com/fatedier/frp.git
synced 2025-07-29 01:07:38 +00:00
sshTunnelGateway refactor (#3784)
This commit is contained in:
@@ -128,3 +128,15 @@ func NewClientTLSConfig(certPath, keyPath, caPath, serverName string) (*tls.Conf
|
||||
|
||||
return base, nil
|
||||
}
|
||||
|
||||
func NewRandomPrivateKey() ([]byte, error) {
|
||||
key, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
keyPEM := pem.EncodeToMemory(&pem.Block{
|
||||
Type: "RSA PRIVATE KEY",
|
||||
Bytes: x509.MarshalPKCS1PrivateKey(key),
|
||||
})
|
||||
return keyPEM, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user