Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Switching to ScaleFT/sshkeys for reading (encrypted) key data. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Jan 17, 2019

This is a follow-on to #7. A few notes:

  • There are no tests, what should I do to test this?
  • Should I update references to Go 1.9 to be Go 1.11?
  • To verify this is correct, should I run make.sh?
  • Where should I add the dependency on ScaleFT/sshkeys?

Thanks

passphrase := []byte(config.Pwd)
var privateKey interface{}
fmt.Println("Decrypting private key with passphrase...")
privateKey, err = sshkeys.ParseEncryptedRawPrivateKey(keyData, passphrase)
Copy link
Contributor Author

@dhermes dhermes Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if passphrase is empty, this will still work provided the key isn't actually encrypted (i.e. the name ParseEncryptedRawPrivateKey is a bit misleading, since the Encrypted isn't strictly necessary)

@dhermes
Copy link
Contributor Author

dhermes commented Feb 7, 2019

@benton Gentle nudge. I'd love to discuss / see what you have to say about the direction of this PR.

I initially thought the BEGIN OPENSSH PRIVATE KEY was just "Apple being Apple" but I realized it's a new format from the openssh maintainers:

The OpenSSH format, supported in OpenSSH releases since 2014 and described in the PROTOCOL.key file in the source distribution, offers substantially better protection against offline password guessing and supports key comments in private keys

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

Successfully merging this pull request may close these issues.

1 participant