Proposals Unofficial Go proposal tracker

Add a unified SignerV2 API to the ssh package

#74424 · x/crypto/ssh · low impact · Accepted ·

The ssh package has three overlapping signer interfaces (Signer, AlgorithmSigner, MultiAlgorithmSigner) and several overlapping constructors and parsers. They grew over time to handle RSA's multiple signature algorithms and DSA keys. The proposal adds a V2 API that will replace the old one when the package moves to the standard library. Users can try it now.

SignerV2 combines the three interfaces into one. It has PublicKey, Sign, SignContext (which takes a context and an optional algorithm), Algorithms, and Signer, which returns the underlying crypto.Signer if one is available. You create one with NewSignerV2 from any crypto.Signer; for RSA keys it excludes SHA-1 algorithms by default.

The V2 API drops DSA keys and legacy RFC 1423 PEM encryption. SignerV2 remains compatible with the existing Signer interface.

signer, err := ssh.ParsePrivateKeyV2(pemBytes, &ssh.ParsePrivateKeyV2Options{
    Passphrase: "secret",
})
if err != nil {
    return err
}
sig, err := signer.SignContext(ctx, rand.Reader, data, ssh.KeyAlgoRSASHA256)
Proposal
#74424 by drakkan
Status
Accepted on Sep 23, 2026
Impact
low
Area
x/crypto/ssh