{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/18692","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/18692/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/18692/comments","events_url":"https://api.github.com/repos/golang/go/issues/18692/events","html_url":"https://github.com/golang/go/issues/18692","id":201387158,"number":18692,"title":"x/crypto/ssh: Support Encrypted Private Keys","user":{"login":"pquerna","id":110123,"avatar_url":"https://avatars2.githubusercontent.com/u/110123?v=3","gravatar_id":"","url":"https://api.github.com/users/pquerna","html_url":"https://github.com/pquerna","followers_url":"https://api.github.com/users/pquerna/followers","following_url":"https://api.github.com/users/pquerna/following{/other_user}","gists_url":"https://api.github.com/users/pquerna/gists{/gist_id}","starred_url":"https://api.github.com/users/pquerna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pquerna/subscriptions","organizations_url":"https://api.github.com/users/pquerna/orgs","repos_url":"https://api.github.com/users/pquerna/repos","events_url":"https://api.github.com/users/pquerna/events{/privacy}","received_events_url":"https://api.github.com/users/pquerna/received_events","type":"User","site_admin":false},"labels":[{"id":236419512,"url":"https://api.github.com/repos/golang/go/labels/Proposal","name":"Proposal","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/30","html_url":"https://github.com/golang/go/milestone/30","labels_url":"https://api.github.com/repos/golang/go/milestones/30/labels","id":1373555,"number":30,"title":"Proposal","description":"Proposals that are pending (not yet accepted/rejected).\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars2.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":102,"closed_issues":178,"state":"open","created_at":"2015-10-24T01:40:49Z","updated_at":"2017-06-13T13:46:25Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2017-01-17T19:49:14Z","updated_at":"2017-06-13T14:01:50Z","closed_at":"2017-06-13T13:46:24Z","body":"### What did you do?\r\n\r\nSSH private keys are often stored on disk encrypted with a password.  There are 2 major formats of these encrypted private keys.  Today `x/crypto/ssh` just returns an error when encountering these keys.\r\n\r\n### What did you expect to see?\r\n\r\n`ssh.ParseRawPrivateKey(...)` supports multiple private key formats, but only supports keys that are not encrypted with a passphrase.\r\n\r\nFor some PEM key formats, `x509.DecryptPEMBlock` works in, but for OpenSSH's newer [openssh-key-v1](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key) format, there is nothing in the stdlib that can decrypt the keys.\r\n\r\n### What did you see instead?\r\n\r\nTwo new methods, `ParseRawPrivateKeyWithPassphrase` and `ParsePrivateKeyWithPassphrase`:\r\n\r\n```\r\nfunc ParsePrivateKeyWithPassphrase(pemBytes []byte, passphrase []byte) (Signer, error)\r\nfunc ParseRawPrivateKeyWithPassphrase(pemBytes []byte, passphrase []byte) (interface{}, error)\r\n```\r\n\r\nFor keys that are PEM encrypted, decrypt them with `x509.DecryptPEMBlock`, and for the keys that are encrypted in OpenSSH's native key format, generate the key using the bcrypt-KDF, and decrypt with AES-256-CBC.\r\n\r\n- The function names are quite long, ideas?\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/308125721","html_url":"https://github.com/golang/go/issues/18692#issuecomment-308125721","issue_url":"https://api.github.com/repos/golang/go/issues/18692","id":308125721,"user":{"login":"mattn","id":10111,"avatar_url":"https://avatars3.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false},"created_at":"2017-06-13T14:01:50Z","updated_at":"2017-06-13T14:01:50Z","body":"Sorry, my mistake. I'll look into it in later. @hanwen could you please re-open this?"}}
{"actor":{"display_login":"mattn"}}