EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP pagent .net sample

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#26949
Posted: 10/23/2013 06:36:04
by Manuel Kaderli (Basic support level)
Joined: 10/23/2013
Posts: 6

Hi,

I'm evaluating the sftp component.
I have to use pagent with a private/public key in order to authenticate.
I saw that you support public-key authentication using Pagent, but i don't know howto use it.

Do you have a c# code sample how to access an sftp server authenticating via Pagent?

cheers
manuel
#26950
Posted: 10/23/2013 06:40:10
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. You should just enable SSH_AUTH_TYPE_PUBLICKEYAGENT authentication type, and everything will be handled automatically.
#26952
Posted: 10/23/2013 07:35:31
by Manuel Kaderli (Basic support level)
Joined: 10/23/2013
Posts: 6

Hi,

In this case, do i have to set the private key via key.LoadPrivateKey?
Or how does the sftp client realize which private key to use from pagent.exe?
#26954
Posted: 10/23/2013 08:11:17
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

You do not need any further setup - our component tries all keys, available from agent, until it succeeds.
#26955
Posted: 10/23/2013 08:28:35
by Manuel Kaderli (Basic support level)
Joined: 10/23/2013
Posts: 6

Hi again,

Thanks for your fast answers.

I guess i'm not far away from a working prototype.

At the moment i just get an exception in OnSocketReceiveCallback
System.MethodAccessException
Attempt by security transparent method 'SBSSHAuthAgent.__Global.PageantAvailable()'
to call native code through method 'SBSSHAuthAgent.__Global.FindWindow(System.String, System.String)'
failed. Methods must be security critical or security safe-critical to call native code.

I already have put
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
into my app.config file, but it did not help.

Do you have an idea from what the reason for this System.MethodAccessException is ?

cheers
#26956
Posted: 10/23/2013 08:57:05
by Eugene Mayevski (EldoS Corp.)

Thank you for the report. We will add the necessary attributes in the next build, expected on Friday.


Sincerely yours
Eugene Mayevski
#26957
Posted: 10/23/2013 09:42:33
by Manuel Kaderli (Basic support level)
Joined: 10/23/2013
Posts: 6

Hi,
Thanks, i'll check this thread then on friday.

One more question:
Does the sftp component support agent forwarding by default?
#26958
Posted: 10/23/2013 09:46:24
by Eugene Mayevski (EldoS Corp.)

Can you please clarify what you mean by "agent forwarding" and "by default"?


Sincerely yours
Eugene Mayevski
#26959
Posted: 10/23/2013 09:56:55
by Manuel Kaderli (Basic support level)
Joined: 10/23/2013
Posts: 6

Agent forwarding means to enable ssh to forward the agent via proxy.
As a sample, this can be configured in winscp:


Does the sftp component support such a setting(agent forwarding), and if yes, how can it be configured?
#26960
Posted: 10/23/2013 10:05:55
by Eugene Mayevski (EldoS Corp.)

Sorry, I still don't understand what it is and which agent is forwarded and where.


Sincerely yours
Eugene Mayevski
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

Topic viewed 2479 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!