func (n *nauth) GenerateKeyPair(passphrase string) ([]byte, []byte, error) {
	priv, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, nil, err
	}
	privDer := x509.MarshalPKCS1PrivateKey(priv)
	privBlock := pem.Block{
		Type:    "RSA PRIVATE KEY",
		Headers: nil,
		Bytes:   privDer,
	}
	privPem := pem.EncodeToMemory(&privBlock)

	pub, err := ssh.NewPublicKey(&priv.PublicKey)
	if err != nil {
		return nil, nil, err
	}
	pubBytes := ssh.MarshalAuthorizedKey(pub)
	return privPem, pubBytes, nil
}
// GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute
GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute
// GenerateKeyPair returns fresh priv / pub keypair takes about 300ms to execute
func (n *nauth) GenerateKeyPair(passphrase string) ([]byte, []byte, error) {
	priv, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, nil, err
	}
	privDer := x509.MarshalPKCS1PrivateKey(priv)
	privBlock := pem.Block{
		Type:    "RSA PRIVATE KEY",
		Headers: nil,
		Bytes:   privDer,
	}
	privPem := pem.EncodeToMemory(&privBlock)
	pub, err := ssh.NewPublicKey(&priv.PublicKey)
	if err != nil {
		return nil, nil, err
	}
	pubBytes := ssh.MarshalAuthorizedKey(pub)
	return privPem, pubBytes, nil
}
func ( n * nauth ) GenerateKeyPair ( passphrase string ) ( [ ] byte , [ ] byte , error ) { priv , err := rsa . GenerateKey ( rand . Reader , 2048 ) if err != nil { return nil , nil , err } privDer := x509 . MarshalPKCS1PrivateKey ( priv ) privBlock := pem . Block { Type : " " , Headers : nil , Bytes : privDer , } privPem := pem . EncodeToMemory ( & privBlock ) pub , err := ssh . NewPublicKey ( & priv . PublicKey ) if err != nil { return nil , nil , err } pubBytes := ssh . MarshalAuthorizedKey ( pub ) return privPem , pubBytes , nil }
GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute
GenerateKeyPair returns fresh priv / pub keypair takes about 300ms to execute