Commit fa3f87a5 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

communicator/ssh: docs

parent 3c5565c5
...@@ -10,6 +10,9 @@ import ( ...@@ -10,6 +10,9 @@ import (
"io" "io"
) )
// SimpleKeychain makes it easy to use private keys in order to connect
// via SSH, since the interface exposed by Go isn't the easiest to use
// right away.
type SimpleKeychain struct { type SimpleKeychain struct {
keys []interface{} keys []interface{}
} }
...@@ -26,6 +29,8 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) { ...@@ -26,6 +29,8 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) {
return return
} }
// AddPEMKeyPassword adds a PEM encoded private key that is protected by
// a password to the keychain.
func (k *SimpleKeychain) AddPEMKeyPassword(key string, password string) (err error) { func (k *SimpleKeychain) AddPEMKeyPassword(key string, password string) (err error) {
block, _ := pem.Decode([]byte(key)) block, _ := pem.Decode([]byte(key))
bytes, _ := x509.DecryptPEMBlock(block, []byte(password)) bytes, _ := x509.DecryptPEMBlock(block, []byte(password))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment