'L{SSHUserAuthClient} can get a private key from a file, and return a
Deferred called back with a private L{Key} object, even if the key is
encrypted.'

def test_getPrivateKeyPassphrase(self):

    rsaPrivate = Key.fromString(keydata.privateRSA_openssh)
    passphrase = 'this    is    the    passphrase'
    self.rsaFile.setContent(rsaPrivate.toString('openssh', passphrase))
    options = ConchOptions()
    options.identitys = [self.rsaFile.path]
    client = SSHUserAuthClient('user', options, None)
    client.getPublicKey()
    def _getPassword(prompt):
        self.assertEqual(prompt, ("Enter    passphrase    for    key    '%s':    " % (self.rsaFile.path,)))
        return nativeString(passphrase)
    def _cbGetPrivateKey(key):
        self.assertFalse(key.isPublic())
        self.assertEqual(key, rsaPrivate)
    self.patch(client, '_getPassword', _getPassword)
    return client.getPrivateKey().addCallback(_cbGetPrivateKey)
