ssh.net update für ecdsa unterstützung

This commit is contained in:
2024-04-16 21:38:37 +02:00
parent a298ae0001
commit e1187607f2
2 changed files with 44 additions and 9 deletions

View File

@@ -97,9 +97,6 @@
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL</HintPath> <HintPath>C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL</HintPath>
</Reference> </Reference>
<Reference Include="Renci.SshNet">
<HintPath>..\..\..\dll\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Deployment" /> <Reference Include="System.Deployment" />
@@ -311,6 +308,20 @@
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Connected Services\" /> <WCFMetadata Include="Connected Services\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="SSH.NET">
<Version>2024.0.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="System.Threading.Tasks.Extensions">
<Version>4.5.4</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -8,6 +8,8 @@ Imports DocumentFormat.OpenXml.Wordprocessing
Imports DAKOSY_Worker Imports DAKOSY_Worker
Imports Renci.SshNet.Messages Imports Renci.SshNet.Messages
Imports System.Windows.Forms.VisualStyles.VisualStyleElement Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports DocumentFormat.OpenXml.Drawing.Charts
Imports iTextSharp.text.xml.simpleparser
Public Class frmDYNachrichtenVerarbeitung Public Class frmDYNachrichtenVerarbeitung
Dim cntDatenEingelesen As Integer = 0 Dim cntDatenEingelesen As Integer = 0
@@ -114,12 +116,31 @@ Public Class frmDYNachrichtenVerarbeitung
Dim DY_PFAD_out = "" Dim DY_PFAD_out = ""
DAKOSY_Worker.cDakosyFunftions.getSFTPLoginData(DY_server, DY_name, DY_pwd, DY_port, "", DY_PFAD_out, "", VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA) DAKOSY_Worker.cDakosyFunftions.getSFTPLoginData(DY_server, DY_name, DY_pwd, DY_port, "", DY_PFAD_out, "", VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA)
Dim ECDSA_host_keytype = "ecdsa-sha2-nistp256" ' AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI3RSVXoxHUFRiQHph842E8zKMuOrh2HkPh/kKaFy97xAORrYtiEAYL7sZ507RoIP689JbXTAOt2yu5/dse9yZo="
Dim rsa_host_keytype = "ssh-rsa" ' AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI3RSVXoxHUFRiQHph842E8zKMuOrh2HkPh/kKaFy97xAORrYtiEAYL7sZ507RoIP689JbXTAOt2yu5/dse9yZo="
Dim ECDSA_host_key As String = "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI3RSVXoxHUFRiQHph842E8zKMuOrh2HkPh/kKaFy97xAORrYtiEAYL7sZ507RoIP689JbXTAOt2yu5/dse9yZo="
Dim SHA256_fingerprint = "KmghfUlqnv/XqRw+FPIdRlp0UYQv6iJf9unHUjHzG5w"
Dim MD5_fingerprint = "cf:64:a2:08:e8:05:20:02:d8:4f:3b:74:6a:f2:43:06"
'Dim privateKey As PrivateKeyFile = New PrivateKeyFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ssh", "id_rsa"), "passphrase")
'Dim sshClient As SshClient = New SshClient("192.168.0.1", 22, "user", privateKey)
'sshClient.Connect()
'Dim command As SshCommand = sshClient.CreateCommand("ls -la")
'command.Execute()
'Dim answer As String = command.Result
Dim ConnectionInfo As New ConnectionInfo(DY_server, DY_port, DY_name, New PasswordAuthenticationMethod(DY_name, DY_pwd)) Dim ConnectionInfo As New ConnectionInfo(DY_server, DY_port, DY_name, New PasswordAuthenticationMethod(DY_name, DY_pwd))
Using client = New SftpClient(ConnectionInfo) Using client = New SftpClient(ConnectionInfo)
client.Connect() client.Connect()
'MsgBox(client.ListDirectory(DY_PFAD_out).Count)
For Each f In client.ListDirectory(DY_PFAD_out) For Each f In client.ListDirectory(DY_PFAD_out)
If Not f.Name.StartsWith(".") And Not f.IsDirectory Then If Not f.Name.StartsWith(".") And Not f.IsDirectory Then
'Temp. DownloadPfad 'Temp. DownloadPfad
@@ -142,8 +163,11 @@ Public Class frmDYNachrichtenVerarbeitung
Next Next
client.Disconnect() client.Disconnect()
End Using End Using
Catch ex As Exception Catch ex As Exception
If ex.Message.Contains("connection was aborted by the server") Then If ex.Message.Contains("connection was aborted by the server") Then
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
'Bei großen Datenmengen kann die Verbindung abbrechen -> nicht alle Elemente werden abgeholt
Else Else
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name) VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)