diff options
| author | Nicola Murino <nicola.murino@gmail.com> | 2024-09-22 09:31:49 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-09-22 09:34:30 +0000 |
| commit | 3d7db7df374a3c9a2e5b1ecad9e4e02d6588dc91 (patch) | |
| tree | 580faf23468e9e7256895860f2334c68c8f5f0bb | |
| parent | 166329992eec585bea4247dcd6c639966604e340 (diff) | |
| download | go-x-proposal-3d7db7df374a3c9a2e5b1ecad9e4e02d6588dc91.tar.xz | |
design/68723-crypto-ssh-v2.md: change NewPublicKey signature
It now accepts a crypto.PublicKey instead of an empty interface.
All public keys in the standard library implement this interface.
Change-Id: I873175a4d4e57803dc3cafdadb800b4f34ae0ca1
GitHub-Last-Rev: 05a3b07a3ad37e5d46be7d24d8f2245b4cfdc1ba
GitHub-Pull-Request: golang/proposal#54
Reviewed-on: https://go-review.googlesource.com/c/proposal/+/614279
Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
Commit-Queue: Nicola Murino <nicola.murino@gmail.com>
Auto-Submit: Nicola Murino <nicola.murino@gmail.com>
| -rw-r--r-- | design/68723-crypto-ssh-v2.md | 4 | ||||
| -rw-r--r-- | design/68723/ssh.html | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/design/68723-crypto-ssh-v2.md b/design/68723-crypto-ssh-v2.md index 5210f9e..94f21f7 100644 --- a/design/68723-crypto-ssh-v2.md +++ b/design/68723-crypto-ssh-v2.md @@ -425,6 +425,10 @@ func MarshalPrivateKey(key crypto.PrivateKey, options MarshalPrivateKeyOptions) This way we can remove `MarshalPrivateKeyWithPassphrase` because the passphrase is now an option. We can easily add support for other options, for example making salt rounds confgurable, see [golang/go#68700](https://github.com/golang/go/issues/68700). +### NewPublicKey + +Change the `NewPublicKey` signature to accept `crypto.PublicKey` instead of an empty interface. All public keys in the standard library implement this interface. + ### Deprecated API and algorithms removal We'll remove DSA support, see [here](https://lists.mindrot.org/pipermail/openssh-unix-announce/2024-January/000156.html) for DSA status in OpenSSH, it is already disabled by default and will be removed in January, 2025. diff --git a/design/68723/ssh.html b/design/68723/ssh.html index 47c353a..81bf882 100644 --- a/design/68723/ssh.html +++ b/design/68723/ssh.html @@ -777,7 +777,7 @@ so its API may be changed when pressing needs arise. <li> <a href="#PublicKey">type PublicKey</a> <ul> - <li><a href="#NewPublicKey">func NewPublicKey(key interface{}) (PublicKey, error)</a></li> + <li><a href="#NewPublicKey">func NewPublicKey(key crypto.PublicKey) (PublicKey, error)</a></li> <li><a href="#ParseAuthorizedKey">func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error)</a></li> <li><a href="#ParseKnownHosts">func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey, comment string, rest []byte, ...)</a></li> <li><a href="#ParsePublicKey">func ParsePublicKey(in []byte) (out PublicKey, err error)</a></li> @@ -1986,10 +1986,10 @@ encoded private key and passphrase. It supports the same keys as <p>PublicKey represents a public key using an unspecified algorithm. <p>Some PublicKeys provided by this package also implement CryptoPublicKey. <h4 id="NewPublicKey">func NewPublicKey</h4> - <pre class="chroma"><span class="kd">func</span> <span class="nf">NewPublicKey</span><span class="p">(</span><span class="nx">key</span> <span class="kd">interface</span><span class="p">{})</span> <span class="p">(</span><a href="#PublicKey"><span class="nx">PublicKey</span></a><span class="p">,</span> <a href="https://pkg.go.dev/builtin#error"><span class="kt">error</span></a><span class="p">)</span></pre> - <p>NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey, -or ed25519.PublicKey returns a corresponding PublicKey instance. -ECDSA keys must use P-256, P-384 or P-521. +<pre class="chroma"><span class="kd">func</span> <span class="nf">NewPublicKey</span><span class="p">(</span><span class="nx">key</span> <a href="https://pkg.go.dev/crypto"><span class="nx">crypto</span></a><span class="p">.</span><a href="https://pkg.go.dev/crypto#PublicKey"><span class="nx">PublicKey</span></a><span class="p">)</span> <span class="p">(</span><a href="#PublicKey"><span class="nx">PublicKey</span></a><span class="p">,</span> <a href="https://pkg.go.dev/builtin#error"><span class="kt">error</span></a><span class="p">)</span></pre> + <p>NewPublicKey takes an *rsa.PublicKey, *ecdsa.PublicKey, or ed25519.PublicKey +returns a corresponding PublicKey instance. ECDSA keys must use P-256, P-384 +or P-521. <h4 id="ParseAuthorizedKey">func ParseAuthorizedKey</h4> <pre class="chroma"><span class="kd">func</span> <span class="nf">ParseAuthorizedKey</span><span class="p">(</span><span class="nx">in</span> <span class="p">[]</span><a href="https://pkg.go.dev/builtin#byte"><span class="kt">byte</span></a><span class="p">)</span> <span class="p">(</span><span class="nx">out</span> <a href="#PublicKey"><span class="nx">PublicKey</span></a><span class="p">,</span> <span class="nx">comment</span> <a href="https://pkg.go.dev/builtin#string"><span class="kt">string</span></a><span class="p">,</span> <span class="nx">options</span> <span class="p">[]</span><a href="https://pkg.go.dev/builtin#string"><span class="kt">string</span></a><span class="p">,</span> <span class="nx">rest</span> <span class="p">[]</span><a href="https://pkg.go.dev/builtin#byte"><span class="kt">byte</span></a><span class="p">,</span> <span class="nx">err</span> <a href="https://pkg.go.dev/builtin#error"><span class="kt">error</span></a><span class="p">)</span></pre> <p>ParseAuthorizedKey parses a public key from an authorized_keys |
