mirror of
https://github.com/hanzokms/cli.git
synced 2026-10-30 20:30:00 +00:00
17 lines
330 B
Go
17 lines
330 B
Go
package ssh
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"crypto/rsa"
|
|
"fmt"
|
|
)
|
|
|
|
// generateRSAKey generates a 2048-bit RSA private key
|
|
func generateRSAKey() (*rsa.PrivateKey, error) {
|
|
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to generate RSA key: %w", err)
|
|
}
|
|
return privateKey, nil
|
|
}
|