Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PrivateKeyFileWithPassphrase #11

Open
fagnercarvalho opened this issue Feb 16, 2021 · 1 comment
Open

Add PrivateKeyFileWithPassphrase #11

fagnercarvalho opened this issue Feb 16, 2021 · 1 comment

Comments

@fagnercarvalho
Copy link

Could we please add a PrivateKeyFileWithPassphrase for parsing private key files with a passphrase?

I can create a PR for it if you want to.

func PrivateKeyFileWithPassphrase(file string, passphrase string) ssh.AuthMethod {
	buffer, err := ioutil.ReadFile(file)
	if err != nil {
		return nil
	}

	key, err := ssh.ParsePrivateKeyWithPassphrase(buffer, []byte(passphrase))
	if err != nil {
		return nil
	}

	return ssh.PublicKeys(key)
}
@elliotchance
Copy link
Owner

Yes. Please add a PR for this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants