go.crypto/ssh: introduce Signer method, an abstraction of
private keys.
R=agl, jpsugar, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/13338044
diff --git a/ssh/example_test.go b/ssh/example_test.go
index 715afb3..a88a677 100644
--- a/ssh/example_test.go
+++ b/ssh/example_test.go
@@ -23,14 +23,18 @@
},
}
- pemBytes, err := ioutil.ReadFile("id_rsa")
+ privateBytes, err := ioutil.ReadFile("id_rsa")
if err != nil {
panic("Failed to load private key")
}
- if err = config.SetRSAPrivateKey(pemBytes); err != nil {
+
+ private, err := ParsePrivateKey(privateBytes)
+ if err != nil {
panic("Failed to parse private key")
}
+ config.AddHostKey(private)
+
// Once a ServerConfig has been configured, connections can be
// accepted.
listener, err := Listen("tcp", "0.0.0.0:2022", config)