←Select platform

BaseClient Class

Summary

An abstract class that specifies Transport Layer Security (TLS) settings used by an SCU to connect securely to an SCP.

Syntax
C#
VB
C++
public abstract class BaseClient 
Public MustInherit Class BaseClient 
public: 
   ref class BaseClient abstract 
Remarks

The following SCU classes derive from the BaseClient abstract class, so all members of the BaseClient class are included in these classes:

Any of the above SCU classes can connect to an SCP that is accepting secure Transport Layer Security (TLS) by specifying the following properties:

Example

This example uses all members from the BaseClient to connect securely (TLS) to an SCP that is accepting secure connections.

C#
VB
using LeadtoolsExamples.Common; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Scu.Common; 
using Leadtools.ImageProcessing; 
using Leadtools.Dicom.AddIn.Common; 
using Leadtools.Dicom.Scu; 
using Leadtools.Medical.Workstation.Client; 
using Leadtools.Medical.Workstation.Client.Local; 
using Leadtools.Medical.Workstation.Client.Pacs; 
 
// public void QueryPACSSecure() 
{ 
   // Leadtools.Examples.Support.SetLicense(); 
 
   AeInfo clientInfo = new AeInfo(); 
   DicomScp scpInfo = new DicomScp(); 
 
   clientInfo.Address = Dns.GetHostName(); //local machine 
   clientInfo.AETitle = "L20_CLIENT64"; 
   clientInfo.Port = 1030; 
 
 
   scpInfo.AETitle = "L20_PACS_SCP64"; 
   scpInfo.PeerAddress = IPAddress.Parse("192.168.5.101"); 
   scpInfo.Port = 534; 
   scpInfo.Timeout = 30; 
 
   scpInfo.Secure = true; 
 
   PacsQueryClient client = new PacsQueryClient(clientInfo, scpInfo); 
 
   client.EnableLog = true; 
   client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt"); 
 
   // Set client security settings 
   DicomOpenSslContextCreationSettings settings = new DicomOpenSslContextCreationSettings( 
      DicomSslMethodType.SslV23, 
      Path.Combine(LEAD_VARS.CertificatesDir, "ca.pem"), 
      DicomOpenSslVerificationFlags.None, 
      9, 
      DicomOpenSslOptionsFlags.AllBugWorkarounds 
      ); 
 
   client.OpenSslContextCreationSettings = settings; 
   client.ClientCertificate = Path.Combine(LEAD_VARS.CertificatesDir, "client.pem"); 
   client.ClientCertificateKey = Path.Combine(LEAD_VARS.CertificatesDir, "client.pem"); 
   client.ClientCertificateKeyPassword = "test"; 
   client.ClientCertificateType = DicomTlsCertificateType.Pem; 
   client.CipherSuiteList.Add(DicomTlsCipherSuiteType.EcdheRsaWithAes128GcmSha256); 
 
   PerformClientQuery(client); 
} 
 
public void PerformClientQuery(QueryClient client) 
{ 
   FindQuery studiesQuery = new FindQuery(); 
 
 
   DicomDataSet[] studies = client.FindStudies(studiesQuery); 
 
 
   if (studies.Length > 0) 
   { 
      DicomDataSet study = studies[0]; 
      FindQuery seriesQuery = new FindQuery(); 
 
 
      seriesQuery.StudyInstanceUID = study.GetValue<string>(DicomTag.StudyInstanceUID, string.Empty); 
 
      DicomDataSet[] series = client.FindSeries(seriesQuery); 
 
      foreach (DicomDataSet seriesDS in series) 
      { 
         FindQuery imagesQuery = new FindQuery(); 
 
 
         imagesQuery.SeriesInstanceUID = seriesDS.GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty); 
 
         DicomDataSet[] images = client.FindImages(imagesQuery); 
 
 
         foreach (DicomDataSet instance in images) 
         { 
            Console.WriteLine("SOPInstanceUID: {0}", instance.GetValue<string>(DicomTag.SOPInstanceUID, string.Empty)); 
 
            Console.WriteLine("SeriesInstanceUID: {0}", instance.GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty)); 
 
            Console.WriteLine("StudyInstanceUID: {0}", instance.GetValue<string>(DicomTag.StudyInstanceUID, string.Empty)); 
         } 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports LeadtoolsExamples.Common 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Dicom 
Imports Leadtools.Dicom.Scu.Common 
Imports Leadtools.ImageProcessing 
Imports Leadtools.Dicom.AddIn.Common 
Imports Leadtools.Dicom.Scu 
Imports Leadtools.Medical.Workstation.Client 
Imports Leadtools.Medical.Workstation.Client.Local 
Imports Leadtools.Medical.Workstation.Client.Pacs 
 
' Public Sub QueryPACSSecure() 
    ' Leadtools.Examples.Support.SetLicense(); 
 
    Dim clientInfo As New AeInfo() 
    Dim scpInfo As New DicomScp() 
 
    clientInfo.Address = Dns.GetHostName() 'local machine 
    clientInfo.AETitle = "L20_CLIENT64" 
    clientInfo.Port = 1030 
 
 
    scpInfo.AETitle = "L20_PACS_SCP64" 
    scpInfo.PeerAddress = IPAddress.Parse("192.168.5.101") 
    scpInfo.Port = 534 
    scpInfo.Timeout = 30 
 
    scpInfo.Secure = True 
 
    Dim client As New PacsQueryClient(clientInfo, scpInfo) 
 
    client.EnableLog = True 
    client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt") 
 
    ' Set client security settings 
    Dim settings As New DicomOpenSslContextCreationSettings(DicomSslMethodType.SslV23, Path.Combine(LEAD_VARS.CertificatesDir, "ca.pem"), DicomOpenSslVerificationFlags.None, 9, DicomOpenSslOptionsFlags.AllBugWorkarounds) 
 
    client.OpenSslContextCreationSettings = settings 
    client.ClientCertificate = Path.Combine(LEAD_VARS.CertificatesDir, "client.pem") 
    client.ClientCertificateKey = Path.Combine(LEAD_VARS.CertificatesDir, "client.pem") 
    client.ClientCertificateKeyPassword = "test" 
    client.ClientCertificateType = DicomTlsCertificateType.Pem 
    client.CipherSuiteList.Add(DicomTlsCipherSuiteType.EcdheRsaWithAes128GcmSha256) 
 
    PerformClientQuery(client) 
End Sub 
 
Public Sub PerformClientQuery(ByVal client As QueryClient) 
    Dim studiesQuery As New FindQuery() 
 
 
    Dim studies() As DicomDataSet = client.FindStudies(studiesQuery) 
 
 
    If studies.Length > 0 Then 
        Dim study As DicomDataSet = studies(0) 
        Dim seriesQuery As New FindQuery() 
 
 
        seriesQuery.StudyInstanceUID = study.GetValue(Of String)(DicomTag.StudyInstanceUID, String.Empty) 
 
        Dim series() As DicomDataSet = client.FindSeries(seriesQuery) 
 
        For Each seriesDS As DicomDataSet In series 
            Dim imagesQuery As New FindQuery() 
 
 
            imagesQuery.SeriesInstanceUID = seriesDS.GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty) 
 
            Dim images() As DicomDataSet = client.FindImages(imagesQuery) 
 
 
            For Each instance As DicomDataSet In images 
                Console.WriteLine("SOPInstanceUID: {0}", instance.GetValue(Of String)(DicomTag.SOPInstanceUID, String.Empty)) 
 
                Console.WriteLine("SeriesInstanceUID: {0}", instance.GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty)) 
 
                Console.WriteLine("StudyInstanceUID: {0}", instance.GetValue(Of String)(DicomTag.StudyInstanceUID, String.Empty)) 
            Next instance 
        Next seriesDS 
    End If 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements
Target Platforms
Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Medical.Workstation.Client Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.