|
|
|
|
@ -10,6 +10,9 @@ import (
|
|
|
|
|
"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 {
|
|
|
|
|
keys []interface{}
|
|
|
|
|
}
|
|
|
|
|
@ -26,6 +29,8 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) {
|
|
|
|
|
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) {
|
|
|
|
|
block, _ := pem.Decode([]byte(key))
|
|
|
|
|
bytes, _ := x509.DecryptPEMBlock(block, []byte(password))
|
|
|
|
|
|