diff --git a/dotnet/IEC61850forCSharp/TLS.cs b/dotnet/IEC61850forCSharp/TLS.cs
index 05512a9b..d645c547 100644
--- a/dotnet/IEC61850forCSharp/TLS.cs
+++ b/dotnet/IEC61850forCSharp/TLS.cs
@@ -1,7 +1,7 @@
/*
* TLS.cs
*
- * Copyright 2017-2022 Michael Zillgith
+ * Copyright 2017-2024 Michael Zillgith
*
* This file is part of libIEC61850.
*
@@ -69,7 +69,9 @@ namespace IEC61850
ALM_CERT_EXPIRED = 11,
ALM_CERT_REVOKED = 12,
ALM_CERT_NOT_CONFIGURED = 13,
- ALM_CERT_NOT_TRUSTED = 14
+ ALM_CERT_NOT_TRUSTED = 14,
+ ALM_NO_CIPHER = 15,
+ INF_SESSION_ESTABLISHED = 16
}
public class TLSConnection
@@ -261,6 +263,18 @@ namespace IEC61850
[return: MarshalAs(UnmanagedType.I1)]
static extern bool TLSConfiguration_addCACertificateFromFile(IntPtr self, string filename);
+ [DllImport("tase2", CallingConvention = CallingConvention.Cdecl)]
+ static extern void TLSConfiguration_setMinTlsVersion(IntPtr self, int version);
+
+ [DllImport("tase2", CallingConvention = CallingConvention.Cdecl)]
+ static extern void TLSConfiguration_setMaxTlsVersion(IntPtr self, int version);
+
+ [DllImport("tase2", CallingConvention = CallingConvention.Cdecl)]
+ static extern void TLSConfiguration_addCipherSuite(IntPtr self, int ciphersuite);
+
+ [DllImport("tase2", CallingConvention = CallingConvention.Cdecl)]
+ static extern void TLSConfiguration_clearCipherSuiteList(IntPtr self);
+
private TLSEventHandler eventHandler = null;
private object eventHandlerParameter = null;
@@ -417,6 +431,53 @@ namespace IEC61850
}
}
+ ///
+ /// Set minimal allowed TLS version to use
+ ///
+ /// lowest allowed TLS version
+ public void SetMinTlsVersion(TLSConfigVersion version)
+ {
+ TLSConfiguration_setMinTlsVersion(self, (int)version);
+ }
+
+ ///
+ /// Set highest allowed TLS version to use
+ ///
+ /// highest allowed TLS version
+ public void SetMaxTlsVersion(TLSConfigVersion version)
+ {
+ TLSConfiguration_setMaxTlsVersion(self, (int)version);
+ }
+
+#if NET
+ ///
+ /// Add an allowed ciphersuite to the list of allowed ciphersuites
+ ///
+ ///
+ public void addCipherSuite(TlsCipherSuite ciphersuite)
+ {
+ TLSConfiguration_addCipherSuite(self,(int) ciphersuite);
+ }
+#endif
+ ///
+ /// Add an allowed ciphersuite to the list of allowed ciphersuites
+ ///
+ /// Version for .NET framework that does not support TlsCipherSuite enum
+ ///
+ public void addCipherSuite(int ciphersuite)
+ {
+ TLSConfiguration_addCipherSuite(self, ciphersuite);
+ }
+
+ ///
+ /// Clears list of allowed ciphersuites
+ ///
+ ///
+ public void clearCipherSuiteList()
+ {
+ TLSConfiguration_clearCipherSuiteList(self);
+ }
+
public void Dispose()
{
lock (this)