communicator/ssh: docs
This commit is contained in:
parent
3c5565c541
commit
fa3f87a5f6
|
@ -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) {
|
||||||
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))
|
||||||
|
|
Loading…
Reference in New Issue