I'm having a problem with KnownHosts.LoadKnownHosts(stream). I'm writing a string that contains the correct key in the format that KnownHosts.WriteKnownHosts() creates into the stream, but no key is added to the collection.
Stream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.WriteLine(_knownHost);
writer.Flush();
_ftpConnection.KnownHosts.LoadKnownHosts(stream);
writer.Close();
stream.Close();
If I check KnownHosts.NumHosts after it's 0 and I get a SFTPException: Authentication failure, since there are no keys in the collection. Is there something I'm missing, or is there something wrong with the KnownHosts.LoadKnownHosts(stream)?
Thanks,