diff --git a/Interfaces/GraphQLInterface.vb b/Interfaces/GraphQLInterface.vb
index fe19ea41..9ca6f136 100644
--- a/Interfaces/GraphQLInterface.vb
+++ b/Interfaces/GraphQLInterface.vb
@@ -30,34 +30,57 @@ Public Class GraphQLInterface
_userEmail = Email
_userPassword = Password
- Dim oStore As New X509Store(StoreName.Root, StoreLocation.CurrentUser)
- oStore.Open(OpenFlags.ReadOnly)
+ Dim oStoreNames As New List(Of StoreName) From {StoreName.Root, StoreName.My}
+ Dim oCertificate As X509Certificate2 = Nothing
+ For Each oStoreName In oStoreNames
+ oCertificate = FindCertificateByFingerprint(oStoreName, CertificateFingerprint, False)
- _logger.Debug("Available Certificates ({0}):", oStore.Certificates.Count)
-
- For Each oCert In oStore.Certificates
- _logger.Debug("FriendlyName: {0}", oCert.FriendlyName)
- _logger.Debug("IssuerName: {0}", oCert.IssuerName.Name)
- _logger.Debug("SubjectName: {0}", oCert.SubjectName.Name)
- _logger.Debug("Fingerprint: {0}", oCert.Thumbprint)
+ If oCertificate IsNot Nothing Then
+ _logger.Info("Certificate found in Store [{0}]!", oStoreName.ToString)
+ Exit For
+ End If
Next
- _logger.Debug("Looking for Certificate with Fingerprint [{0}]", CertificateFingerprint)
-
- Dim oFoundCerts = oStore.Certificates.Find(X509FindType.FindByThumbprint, CertificateFingerprint, False)
-
- If oFoundCerts.Count = 0 Then
+ If oCertificate Is Nothing Then
_logger.Warn("Certificate could not be found! Exiting.")
Exit Sub
End If
- _certificate = oFoundCerts.Item(0)
+ _certificate = oCertificate
+
Catch ex As Exception
_logger.Error(ex)
End Try
End Sub
+ Private Function FindCertificateByFingerprint(pStoreName As StoreName, pFingerprint As String, pValidOnly As Boolean) As X509Certificate2
+ Dim oStore As New X509Store(pStoreName, StoreLocation.CurrentUser)
+ oStore.Open(OpenFlags.ReadOnly)
+
+ _logger.Info("Available Certificates in Store [{0}]: [{1}]", oStore.Name, oStore.Certificates.Count)
+
+ For Each oCert In oStore.Certificates
+ _logger.Debug("FriendlyName: {0}", oCert.FriendlyName)
+ _logger.Debug("IssuerName: {0}", oCert.IssuerName.Name)
+ _logger.Debug("SubjectName: {0}", oCert.SubjectName.Name)
+ _logger.Debug("Fingerprint: {0}", oCert.Thumbprint)
+ Next
+
+ _logger.Debug("Looking for Certificate with Fingerprint [{0}]", pFingerprint)
+
+ Dim oFoundCerts = oStore.Certificates.Find(X509FindType.FindByThumbprint, pFingerprint, pValidOnly)
+
+ oStore.Close()
+
+ If oFoundCerts.Count = 0 Then
+ Return Nothing
+ End If
+
+ Return oFoundCerts.Item(0)
+
+ End Function
+
Public Sub SaveCookies(Cookie As Cookie)
GetCookies().Add(Cookie)
End Sub
@@ -144,13 +167,18 @@ Public Class GraphQLInterface
Private Function GetRequest(Url As String, PostData As Byte()) As HttpWebRequest
Try
+ ' Set supported TLS versions for WebRequest
+ ' Source: https://stackoverflow.com/questions/10822509/the-request-was-aborted-could-not-create-ssl-tls-secure-channel
+ 'SetSecurityOptions()
+ 'SetSecurityOptionsInsecure()
+ 'SetSecurityOptionsModern()
+
Dim oRequest As HttpWebRequest = WebRequest.Create($"{_baseUrl}{Url}")
oRequest.Method = "POST"
oRequest.ContentType = "application/json"
oRequest.ContentLength = PostData.Length
oRequest.ClientCertificates.Add(_certificate)
oRequest.CookieContainer = GetCookies()
-
oRequest.Proxy = Nothing
If Proxy Is Nothing Then
@@ -167,6 +195,26 @@ Public Class GraphQLInterface
End Try
End Function
+
+ Private Sub SetSecurityOptions()
+ ServicePointManager.SecurityProtocol =
+ SecurityProtocolType.Tls Or
+ SecurityProtocolType.Tls11 Or
+ SecurityProtocolType.Tls12
+ End Sub
+
+ Private Sub SetSecurityOptionsInsecure()
+ ServicePointManager.SecurityProtocol =
+ SecurityProtocolType.Tls Or
+ SecurityProtocolType.Tls11 Or
+ SecurityProtocolType.Tls12 Or
+ SecurityProtocolType.Ssl3
+ End Sub
+
+ Private Sub SetSecurityOptionsModern()
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
+ End Sub
+
Private Function GetCookies() As CookieContainer
If _cookieJar Is Nothing Then
_cookieJar = New CookieContainer(MAX_COOKIE_COUNT, MAX_COOKIE_COUNT_PER_DOMAIN, MAX_COOKIE_SIZE)
diff --git a/Interfaces/Interfaces.vbproj b/Interfaces/Interfaces.vbproj
index 49d6450e..fe48e50a 100644
--- a/Interfaces/Interfaces.vbproj
+++ b/Interfaces/Interfaces.vbproj
@@ -10,7 +10,8 @@
DigitalData.Modules.Interfaces
512
Windows
- v4.6.1
+ v4.6.2
+
true
@@ -98,6 +99,7 @@
True
Application.myapp
+ True
True
diff --git a/Interfaces/My Project/AssemblyInfo.vb b/Interfaces/My Project/AssemblyInfo.vb
index 0e85f009..ee65c3cc 100644
--- a/Interfaces/My Project/AssemblyInfo.vb
+++ b/Interfaces/My Project/AssemblyInfo.vb
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
-
+
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/Interfaces/My Project/Resources.Designer.vb b/Interfaces/My Project/Resources.Designer.vb
index 46a82a82..8adaa3ef 100644
--- a/Interfaces/My Project/Resources.Designer.vb
+++ b/Interfaces/My Project/Resources.Designer.vb
@@ -22,7 +22,7 @@ Namespace My.Resources
'''
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''
- _
diff --git a/Interfaces/My Project/Settings.Designer.vb b/Interfaces/My Project/Settings.Designer.vb
index 2f22163c..e383b12a 100644
--- a/Interfaces/My Project/Settings.Designer.vb
+++ b/Interfaces/My Project/Settings.Designer.vb
@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
_
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
diff --git a/Interfaces/app.config b/Interfaces/app.config
index d5fed9f7..99f551b0 100644
--- a/Interfaces/app.config
+++ b/Interfaces/app.config
@@ -1,11 +1,11 @@
-
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/Jobs/App.config b/Jobs/App.config
index 6117847c..276809a3 100644
--- a/Jobs/App.config
+++ b/Jobs/App.config
@@ -1,14 +1,14 @@
-
+
-
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/Jobs/Jobs.vbproj b/Jobs/Jobs.vbproj
index 50dee6c2..2f0e18f7 100644
--- a/Jobs/Jobs.vbproj
+++ b/Jobs/Jobs.vbproj
@@ -10,9 +10,10 @@
DigitalData.Modules.Jobs
512
Empty
- v4.6.1
+ v4.6.2
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
true
+
AnyCPU
diff --git a/Jobs/My Project/Settings.Designer.vb b/Jobs/My Project/Settings.Designer.vb
index b89e781b..0d240d08 100644
--- a/Jobs/My Project/Settings.Designer.vb
+++ b/Jobs/My Project/Settings.Designer.vb
@@ -14,7 +14,7 @@ Option Explicit On
_
Partial Friend NotInheritable Class Settings
Inherits Global.System.Configuration.ApplicationSettingsBase