Specifies the type of cipher suite used in the TLS security.
public enum DicomTlsCipherSuiteType Public Enum DicomTlsCipherSuiteType
public enum DicomTlsCipherSuiteType Leadtools.Dicom.DicomTlsCipherSuiteType = function() { };Leadtools.Dicom.DicomTlsCipherSuiteType.prototype = {LeadtoolsMemberMarker(replace me)};
public enum class DicomTlsCipherSuiteType Members
| Value | Member | Description |
|---|---|---|
| 0 | None | No cipher suite has been agreed upon yet. |
| 18 | DheRsaWithDesCbcSha | Type 2. |
| 19 | DheRsaWith3DesEdeCbcSha | Type 1. |
| 20 | DheRsaAes256Sha | Type 3 |
Currently, only the cipher suites listed below are supported by LEADTOOLS.
This is a comprehensive sample that shows how to use DICOM Secure communication using TLS.
using Leadtools;using Leadtools.Dicom;[StructLayout(LayoutKind.Sequential)]public struct MSG{public IntPtr hwnd;public uint message;public IntPtr wParam;public IntPtr lParam;public uint time;public System.Drawing.Point p;}public enum WaitReturn{Complete,Timeout,}class Utils{[DllImport("user32.dll")][return: MarshalAs(UnmanagedType.Bool)]static extern bool PeekMessage(out MSG lpMsg, IntPtr hWnd,uint wMsgFilterMin, uint wMsgFilterMax,uint wRemoveMsg);[DllImport("user32.dll")]static extern bool TranslateMessage([In] ref MSG lpMsg);[DllImport("user32.dll")]static extern IntPtr DispatchMessage([In] ref MSG lpmsg);const uint PM_REMOVE = 1;public static WaitReturn WaitForComplete(double mill, WaitHandle wh){TimeSpan goal = new TimeSpan(DateTime.Now.AddMilliseconds(mill).Ticks);do{MSG msg = new MSG();if (PeekMessage(out msg, IntPtr.Zero, 0, 0, PM_REMOVE)){TranslateMessage(ref msg);DispatchMessage(ref msg);}if (wh.WaitOne(new TimeSpan(0, 0, 0), false)){return WaitReturn.Complete;}if (goal.CompareTo(new TimeSpan(DateTime.Now.Ticks)) < 0){return WaitReturn.Timeout;}} while (true);}}//// Secure client (TLS)//class Client : DicomNet{AutoResetEvent waitEvent = new AutoResetEvent(false);string clientPEM = Path.Combine(LEAD_VARS.ImagesDir, "client.pem");public Client(): base(null, DicomNetSecurityeMode.Tls){SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.DheRsaWithDesCbcSha);SetTlsClientCertificate(clientPEM, DicomTlsCertificateType.Pem, null);}public bool Wait(){WaitReturn ret;ret = Utils.WaitForComplete((5 * 60) * 1000, waitEvent);return (ret == WaitReturn.Complete);}protected override void OnConnect(DicomExceptionCode error){waitEvent.Set();}protected override string OnPrivateKeyPassword(bool encryption){return "test";}protected override void OnSecureLinkReady(DicomExceptionCode error){waitEvent.Set();}}//// Secure server (TLS)//class ServerConnection : DicomNet{string serverPEM = Path.Combine(LEAD_VARS.ImagesDir, "server.pem");public ServerConnection(): base(null, DicomNetSecurityeMode.Tls){SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.DheRsaWith3DesEdeCbcSha);SetTlsClientCertificate(serverPEM, DicomTlsCertificateType.Pem, null);}protected override string OnPrivateKeyPassword(bool encryption){return "test";}}class Server : DicomNet{ServerConnection client;public Server(): base(null, DicomNetSecurityeMode.None){}protected override void OnAccept(DicomExceptionCode error){client = new ServerConnection();Accept(client);}protected override void Dispose(bool __p1){client.Dispose();base.Dispose(__p1);}}public void TLSSecuritySample(){DicomEngine.Startup();DicomNet.Startup();using (Server server = new Server()){using (Client client = new Client()){server.Listen("127.0.0.1", 104, 1); // start serverclient.Connect(null, 1000, "127.0.0.1", 104); // connect to serverif (!client.Wait()) // wait for connection to finish{Debug.Fail("Connection timed out");}Debug.Assert(client.IsConnected(), "Client not connected");//// Wait for authenication//if (!client.Wait()){Debug.Fail("Connection timed out waiting for authenication");}// Once two computers have negotiated the ciphersuite, and have// authenticated each other, they can begin transferring// messages and data between them.//Now we can get detailed information about the Cipher SuiteDicomTlsCipherSuiteType cipherSuite = client.GetTlsCipherSuite();// Can also call GetTlsCipherSuiteByIndexConsole.WriteLine("Encryption Algorithm is : {0}", client.GetTlsEncryptionAlgorithm(cipherSuite));Console.WriteLine("Authentication Algorithm is : {0}", client.GetTlsAuthenticationAlgorithm(cipherSuite));Console.WriteLine("Integrity Algorithm is : {0}", client.GetTlsIntegrityAlgorithm(cipherSuite));Console.WriteLine("Key Exchange Algorithm is : {0}", client.GetTlsKeyExchangeAlgorithm(cipherSuite));Console.WriteLine("Encryption Key Length is : {0}", client.GetTlsEncryptionKeyLength(cipherSuite));Console.WriteLine("Mutual Authentication Key Length is : {0}", client.GetTlsMutualAuthenticationKeyLength(cipherSuite));// Continue with normal dicom communicationclient.CloseForced(true);}server.CloseForced(true);}DicomEngine.Shutdown();DicomNet.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.Dicom<StructLayout(LayoutKind.Sequential)>Public Structure MSGPublic hwnd As IntPtrPublic message As UIntegerPublic wParam As IntPtrPublic lParam As IntPtrPublic time As UIntegerPublic p As System.Drawing.PointEnd StructurePublic Enum WaitReturnCompleteTimeoutEnd EnumPrivate Class Utils<DllImport("user32.dll")>Shared Function PeekMessage(<System.Runtime.InteropServices.Out()> ByRef lpMsg As MSG, ByVal hWnd As IntPtr, ByVal wMsgFilterMin As UInteger,ByVal wMsgFilterMax As UInteger, ByVal wRemoveMsg As UInteger) As <MarshalAs(UnmanagedType.Bool)> BooleanEnd Function<DllImport("user32.dll")>Shared Function TranslateMessage(ByRef lpMsg As MSG) As BooleanEnd Function<DllImport("user32.dll")>Shared Function DispatchMessage(ByRef lpmsg As MSG) As IntPtrEnd FunctionPrivate Const PM_REMOVE As UInteger = 1Public Shared Function WaitForComplete(ByVal mill As Double, ByVal wh As WaitHandle) As WaitReturnDim goal As TimeSpan = New TimeSpan(DateTime.Now.AddMilliseconds(mill).Ticks)DoDim msg As MSG = New MSG()If PeekMessage(msg, IntPtr.Zero, 0, 0, PM_REMOVE) ThenTranslateMessage(msg)DispatchMessage(msg)End IfIf wh.WaitOne(New TimeSpan(0, 0, 0), False) ThenReturn WaitReturn.CompleteEnd IfIf goal.CompareTo(New TimeSpan(DateTime.Now.Ticks)) < 0 ThenReturn WaitReturn.TimeoutEnd IfLoop While TrueEnd FunctionEnd Class'' Secure client (TLS)'Private Class Client : Inherits DicomNetPrivate waitEvent As AutoResetEvent = New AutoResetEvent(False)Private clientPEM As String = Path.Combine(LEAD_VARS.ImagesDir, "client.pem")Public Sub New()MyBase.New(Nothing, DicomNetSecurityeMode.Tls)SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.DheRsaWithDesCbcSha)SetTlsClientCertificate(clientPEM, DicomTlsCertificateType.Pem, Nothing)End SubPublic Function Wait() As BooleanDim ret As WaitReturnret = Utils.WaitForComplete((5 * 60) * 1000, waitEvent)Return (ret = WaitReturn.Complete)End FunctionProtected Overrides Sub OnConnect(ByVal [error] As DicomExceptionCode)waitEvent.Set()End SubProtected Overrides Function OnPrivateKeyPassword(ByVal encryption As Boolean) As StringReturn "test"End FunctionProtected Overrides Sub OnSecureLinkReady(ByVal [error] As DicomExceptionCode)waitEvent.Set()End SubEnd Class'' Secure server (TLS)'Private Class ServerConnection : Inherits DicomNetPrivate serverPEM As String = Path.Combine(LEAD_VARS.ImagesDir, "server.pem")Public Sub New()MyBase.New(Nothing, DicomNetSecurityeMode.Tls)SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.DheRsaWith3DesEdeCbcSha)SetTlsClientCertificate(serverPEM, DicomTlsCertificateType.Pem, Nothing)End SubProtected Overrides Function OnPrivateKeyPassword(ByVal encryption As Boolean) As StringReturn "test"End FunctionEnd ClassPrivate Class Server : Inherits DicomNetPrivate client As ServerConnectionPublic Sub New()MyBase.New(Nothing, DicomNetSecurityeMode.None)End SubProtected Overrides Sub OnAccept(ByVal [error] As DicomExceptionCode)client = New ServerConnection()Accept(client)End SubProtected Overloads Overrides Sub Dispose(ByVal __p1 As Boolean)client.Dispose()MyBase.Dispose(__p1)End SubEnd ClassPublic Sub TLSSecuritySample()DicomEngine.Startup()DicomNet.Startup()Using server As Server = New Server()Using client As Client = New Client()server.Listen("127.0.0.1", 104, 1) ' start serverclient.Connect(Nothing, 1000, "127.0.0.1", 104) ' connect to serverIf (Not client.Wait()) Then ' wait for connection to finishDebug.Fail("Connection timed out")End IfDebug.Assert(client.IsConnected(), "Client not connected")'' Wait for authenication'If (Not client.Wait()) ThenDebug.Fail("Connection timed out waiting for authenication")End If' Once two computers have negotiated the ciphersuite, and have' authenticated each other, they can begin transferring' messages and data between them.' Now we can get detailed information about the Cipher SuiteDim cipherSuite As DicomTlsCipherSuiteTypecipherSuite = client.GetTlsCipherSuite()Console.WriteLine("Encryption Algorithm is : {0}", client.GetTlsEncryptionAlgorithm(cipherSuite))Console.WriteLine("Authentication Algorithm is : {0}", client.GetTlsAuthenticationAlgorithm(cipherSuite))Console.WriteLine("Integrity Algorithm is : {0}", client.GetTlsIntegrityAlgorithm(cipherSuite))Console.WriteLine("Key Exchange Algorithm is : {0}", client.GetTlsKeyExchangeAlgorithm(cipherSuite))Console.WriteLine("Encryption Key Length is : {0}", client.GetTlsEncryptionKeyLength(cipherSuite))Console.WriteLine("Mutual Authentication Key Length is : {0}", client.GetTlsMutualAuthenticationKeyLength(cipherSuite))' Continue with normal dicom communicationclient.CloseForced(True)End Usingserver.CloseForced(True)End UsingDicomEngine.Shutdown()DicomNet.Shutdown()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
GetTlsCipherSuiteByIndex Method
SetTlsCipherSuiteByIndex Method
GetTlsEncryptionAlgorithm Method
GetTlsAuthenticationAlgorithm Method
GetTlsIntegrityAlgorithm Method
GetTlsKeyExchangeAlgorithm Method
|
Products |
Support |
Feedback: DicomTlsCipherSuiteType Enumeration - Leadtools.Dicom |
Introduction |
Help Version 19.0.2017.6.19
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.