←Select platform

GetSignature Method

Summary
Returns the Digital Signatures Sequence Item that corresponds to the Digital Signature at the specified index.
Syntax
C#
C++/CLI
public DicomElement GetSignature( 
   DicomElement item, 
   int index 
) 
public: 
DicomElement^ GetSignature(  
   DicomElement^ item, 
   int index 
)  

Parameters

item
The item in which the required Digital Signature is located. Set this parameter to null if the Digital Signature is located in the main Data Set.

index
The zero-based index of the required Digital Signature. This should be a number from 0 to GetSignaturesCount - 1.

Return Value

The Digital Signatures Sequence Item that corresponds to the required Digital Signature, or a null reference (Nothing in VB) if the specified index is invalid.

Remarks

For each Digital Signature in the main Data Set or in an item of a sequence of items, there should be a corresponding item under the Digital Signatures sequence (FFFA,FFFA) located in the main Data Set or in the item. This method can be used to obtain that Digital Signatures Sequence Item. Along with this method, call the GetSignaturesCount method to enumerate the Digital Signatures in the main Data Set or in an item of a sequence of items. Once the Digital Signatures Sequence Item is obtained, the following methods can be used to verify, delete, or get information about the Digital Signature:

VerifySignature

DeleteSignature

GetSignatureUID

GetSignatureDateTime

GetSignedElementsCount

GetSignedElement

GetMacTransferSyntax

GetMacAlgorithm

SaveCertificate

Call the FindSignature method, to search the whole Data Set for a specific Digital Signature.

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
public void EnumerateSignatures() 
{ 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "Signed.dcm"); 
   //Make sure to initialize the DICOM engine, this needs to be done only once  
   //In the whole application 
   DicomEngine.Startup(); 
   using (DicomDataSet dataset = new DicomDataSet()) 
   { 
      //Load DICOM File 
      dataset.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      // We will enumerate the Digital Signatures in the main Data Set 
      int signaturesCount = dataset.GetSignaturesCount(null); 
      if (signaturesCount == 0) 
      { 
         Console.WriteLine("No Digital Signatures in the main Data Set."); 
         return; 
      } 
      string msg; 
      if (signaturesCount == 1) 
      { 
         msg = "There is 1 Digital Signature in the main Data Set.Do you want to examine it?"; 
      } 
      else 
      { 
         msg = String.Format("There are {0} Digital Signatures in the main Data Set. Do you want to examine them?", signaturesCount); 
      } 
 
      Console.WriteLine($"Sample: {msg}"); 
 
      for (int i = 0; i < signaturesCount; i++) 
      { 
         ExamineSignature(dataset, dataset.GetSignature(null, i)); 
      } 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.