aboutsummaryrefslogtreecommitdiff
path: root/ssh/example_test.go
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2013-09-19 14:45:31 -0400
committerAdam Langley <agl@golang.org>2013-09-19 14:45:31 -0400
commit934c14ffe9a2222a6ff26d9bda83e2f9a5cc8580 (patch)
tree33884f575ec8c965e84a190429551c5e49a5f071 /ssh/example_test.go
parent28dc961a18d867afc9c8d143f90212fbea73e4b9 (diff)
downloadgo-x-crypto-934c14ffe9a2222a6ff26d9bda83e2f9a5cc8580.tar.xz
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
Diffstat (limited to 'ssh/example_test.go')
-rw-r--r--ssh/example_test.go8
1 files changed, 6 insertions, 2 deletions
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 @@ func ExampleListen() {
},
}
- 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)