Files
crypto/ssh
Filippo Valsorda 0a08dada0f ssh: reject unencrypted keys from ParsePrivateKeyWithPassphrase
The behavior of ParsePrivateKeyWithPassphrase when the key is
unencrypted is unspecified. Currently, it just parses them like
ParsePrivateKey, which is unlikely to be what anyone wants: for us to
ignore a passphrase that they explicitly passed. It also makes the
implementation of encrypted OpenSSH keys in the next CL more confused.

Instead, make ParsePrivateKey return a PassphraseNeededError, so the
application logic can be ParsePrivateKey -> detect encrypted key ->
obtain passphrase -> ParsePrivateKeyWithPassphrase. That error will also
let us return the public key for OpenSSH keys.

Change-Id: Ife4fb2499ae538bef36e353adf9bc8e902662386
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/207599
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2019-12-05 16:18:47 +00:00
..
2014-04-09 13:57:52 -07:00
2017-12-18 18:48:59 +00:00
2018-10-29 02:12:03 +00:00
2019-11-08 23:12:17 +00:00
2018-10-29 02:12:03 +00:00
2017-11-28 17:48:09 +00:00
2017-11-28 19:40:09 +00:00
2014-04-09 13:57:52 -07:00
2016-07-06 16:40:51 +00:00