Re: Cannot instantiate KeyManager - WeOnlyDo Discussion board

Re: Cannot instantiate KeyManager (General questions)

by Armin, Thursday, March 05, 2009, 10:45 (5741 days ago) @ woddrazen

Well, that is exactly the point: I am not getting to the point where the key would be loaded. It crashes when it is getting instantiated. The CodeSnippet that I have sent you is my entire code. All the application is doing at the moment is to instantiate the keymanager. Everything else is commented. Locally on my machine, where everything is working as expected I am loading the key on this way:

SFTP _sftp = new SFTP();
_sftp.Blocking = true;
_sftp.ListItemsEvent += new WeOnlyDo.Client.SFTP.ListItemsDelegate(this.sftp1_ListItemsEvent);
_sftp.StateChangedEvent += new WeOnlyDo.Client.SFTP.StateChangedDelegate(this.sftp1_StateChangedEvent);
_sftp.Disposed += new EventHandler(_sftp_Disposed);
_sftp.LoopItemEvent += new SFTP.LoopDelegate(_sftp_LoopItemEvent);
_sftp.AttributesEvent += new SFTP.AttributesDelegate(_sftp_AttributesEvent);

WeOnlyDo.Security.Cryptography.KeyManager KM = new WeOnlyDo.Security.Cryptography.KeyManager();
try
{
_sftp.Port = 22;
_sftp.Timeout = 60;

_sftp.PrivateKey = KM.PrivateKey( KM.Load( PathToKey ) );
_sftp.Hostname = HostIp;
_sftp.Authentication = SFTP.Authentications.PublicKey;

Log.Information( SFTP CONNECTING! );
_sftp.Connect();


}
finally
{
KM = null;
}


Complete thread: