An abstract class that specifies Transport Layer Security (TLS) settings used by an SCU to connect securely to an SCP.
public abstract class BaseClient
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:
This example uses all members from the BaseClient to connect securely (TLS) to an SCP that is accepting secure connections.
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:\LEADTOOLS22\Resources\Images";
}