EldoS | Feel safer!

Software components for data protection, secure storage and transfer

System.ExecutionEngineException with SFTP

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 09/26/2008 03:50:38
by Tyson Kopczynski (Basic support level)
Joined: 09/18/2008
Posts: 8

Back again...

So when I try to open up a session with a remote server I get the following (after debugging):
System.ExecutionEngineException was unhandled
Message="Exception of type 'System.ExecutionEngineException' was thrown."

I know that you guys don't support PowerShell, but it would be great if you did. I'd really like to be able to do this from within a script... not managed code.

Here is a stripped down version of trying to open the session:
# Load the base SecureBlackbox assembly.
add-type -Path "C:\Program Files\EldoS\SecureBlackbox.NET\Assemblies\NET_20\SecureBlackbox.dll"

# Load the session license.
[SBUtils.Unit]::SetLicenseKey("...really long key...")

# Next load the SFTP assembly.
add-type -Path "C:\Program Files\EldoS\SecureBlackbox.NET\Assemblies\NET_20\SecureBlackbox.SFTP.dll"

# Create me an SFTP client object and configure it up.
$SFTPClient = new-object SBSimpleSftp.TElSimpleSFTPClient
$SFTPClient.Address = "myserver.reallycooldomain.com"
$SFTPClient.Port = "22"
$SFTPClient.UseInternalSocket = $True

########## Will switch to publickey later.
$SFTPClient.UserName = "myuser"
$SFTPClient.Password = "mypassword"

# Just a place holder for the event... would have code here to check the key.
[ScriptBlock] $action = {write-host $args}

register-objectevent $SFTPClient OnKeyValidate -SourceIdentifier SBSimpleSftp.TElSimpleSFTPClient -Action $action

# And here is where we crash.

Posted: 09/26/2008 04:25:05
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

If I understand right that the "add-type" command references the assembly to use, then please consider referencing SecureBlackbox.SSHClient, SecureBlackbox.SSHCommon and SecureBlackbox.SFTPCommon assemblies as well.

If this does not help, please provide us the call stack when the exception is thrown. It is also a good idea to investigate the exception object to get the information about the underlying exception.
Posted: 09/28/2008 23:07:39
by Tyson Kopczynski (Basic support level)
Joined: 09/18/2008
Posts: 8

Nope... adding the other assemblies did not help. Here is the debug output and call stack (I'm a little rusty), but this should be what you need. As for looking at the exception, I can't the PowerShell process is tanking.

0:008> g
ModLoad: 5e620000 5e87a000 C:\WINNT\assembly\NativeImages_v2.0.50727_32\Microsoft.JScript\b3b62fe820b416515420a6ec17b247c3\Microsoft.JScript.ni.dll
ModLoad: 10000000 10020000 System.EnterpriseServices.Wrapper.dll
ModLoad: 10020000 1006e000 C:\WINNT\assembly\NativeImages_v2.0.50727_32\System.EnterpriseSe#\646131eda5f21f4e6216733d49c22c56\System.EnterpriseServices.Wrapper.dll
ModLoad: 10000000 10020000 C:\WINNT\assembly\GAC_32\System.EnterpriseServices\\System.EnterpriseServices.Wrapper.dll
ModLoad: 71a50000 71a8f000 C:\WINNT\system32\mswsock.dll
ModLoad: 662b0000 66308000 C:\WINNT\system32\hnetcfg.dll
ModLoad: 71a90000 71a98000 C:\WINNT\System32\wshtcpip.dll
ModLoad: 58d40000 58d47000 C:\WINNT\System32\wship6.dll
(2424.211c): CLR exception - code e0434f4d (first chance)
ModLoad: 76f20000 76f47000 C:\WINNT\system32\DNSAPI.dll
ModLoad: 76fb0000 76fb8000 C:\WINNT\System32\winrnr.dll
ModLoad: 76fc0000 76fc6000 C:\WINNT\system32\rasadhlp.dll
(2424.211c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=01372958 ecx=791045bc edx=046ae4f4 esi=00000002 edi=01372974
eip=79e754f3 esp=046adbc4 ebp=00000003 iopl=0 nv up ei ng nz ac po cy
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010293
79e754f3 8b4010 mov eax,dword ptr [eax+10h] ds:0023:00000011=????????
0:003> g
(2424.211c): Break instruction exception - code 80000003 (first chance)
eax=00000001 ebx=00000000 ecx=00000001 edx=046ad6f0 esi=00000000 edi=79ffee24
eip=7c901230 esp=046ad250 ebp=046ad6fc iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
7c901230 cc int 3
0:003> g
eax=77c3b8c1 ebx=00000000 ecx=002d23a8 edx=77c61ae8 esi=7c90e88e edi=80131506
eip=7c90eb94 esp=046ad3d0 ebp=046ad4cc iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
7c90eb94 c3 ret

***Call Stack***
WARNING: Frame IP not in any known module. Following frames may be wrong.
Posted: 09/29/2008 04:20:20
by Ken Ivanov (EldoS Corp.)

Hmm, the call stack is quite strange and does not shed any light at the reason of the issue. Basing on the original exception message one might assume that there is some execution environment problem (such as impossibility to load an assembly or type). Please try to add SBB assemblies to GAC and check if it helps.

We have created a similar script and managed to connect to the test server with it. However, we introduced minor modifications to your code, as we were unable to handle SBB events from Powershell as they do not match EventHandler type signature (as far as we understood, it is not possible to use delegate types other than .NET EventHandler type). That's why we used TrustedKeys property to specify the trusted keys file instead of OnKeyValidate event.
Posted: 09/30/2008 05:06:19
by Tyson Kopczynski (Basic support level)
Joined: 09/18/2008
Posts: 8

Hmmmm... yes, you are most likely right about EventHandler type.

Thanks for your help... I'll see if I can get this to work. But, it looks like I will need to switch over to the SharpSSH. That seems to be working ok.

Posted: 09/30/2008 06:58:09
by Ken Ivanov (EldoS Corp.)

At your wish. From our side, we will also investigate this issue and probably publish some samples or guidelines on using SBB with Powershell.
Posted: 09/30/2008 22:03:59
by Tyson Kopczynski (Basic support level)
Joined: 09/18/2008
Posts: 8

Cool... samples would be really nice. Heck... giving me a snap-in with some cmdlets would rock my world.

Being able to do this from the CLI or a script file would be the coolest thing since sliced bread.

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.



Topic viewed 3579 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!