LDicomDS::GetSignature

#include "ltdic.h"

pDICOMELEMENT LDicomDS::GetSignature( pItem, uIndex)

pDICOMELEMENT pItem;

/* pointer to an Item in a Sequence of Items */

L_UINT32 uIndex;

/* index of the Digital Signature */

Returns a pointer to the Digital Signatures Sequence Item that corresponds to the Digital Signature at the specified index.

Parameter

Description

pItem

Pointer to a DICOMELEMENT structure that specifies 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.

uIndex

The index of the required Digital Signature. This should be a number from 0 to LDicomDS::GetSignaturesCount(pItem) minus 1.

Returns

!NULL

Pointer to the DICOMELEMENT structure that specifies the Digital Signatures Sequence Item which corresponds to the required Digital Signature.

NULL

The specified index is invalid.

Comments

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 function can be used to obtain a pointer to that Digital Signatures Sequence Item.

Along with this function, the function LDicomDS::GetSignaturesCount can be used to enumerate the Digital Signatures in the main Data Set or in an Item of a Sequence of Items. Once a pointer to the Digital Signatures Sequence Item is obtained, the following functions can be used to verify, delete, or get information about the Digital Signature:

LDicomDS::VerifySignature

LDicomDS::DeleteSignature

LDicomDS::GetSignatureUID

LDicomDS::GetSignatureDateTime

LDicomDS::GetSignedElementsCount

LDicomDS::GetSignedElement

LDicomDS::GetMacTransferSyntax

LDicomDS::GetMacAlgorithm

LDicomDS::SaveCertificate

You can also use the function LDicomDS::FindSignature to search the whole Data Set for a specific Digital Signature.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LDicomDS::GetSignaturesCount, LDicomDS::FindSignature, LDicomDS::VerifySignature, LDicomDS::DeleteSignature, LDicomDS::GetSignatureUID, LDicomDS::GetSignatureDateTime, LDicomDS::GetSignedElementsCount, LDicomDS::GetSignedElement, LDicomDS::GetMacTransferSyntax, LDicomDS::GetMacAlgorithm, LDicomDS::SaveCertificate, LDicomDS::CreateSignature, Class Members

Topics:

Working with Digital Signatures

Example

L_VOID EnumerateSignatures(LDicomDS& DataSet) 
{
   // We will enumerate the Digital Signatures in the main Data Set

   L_UINT32 uSignaturesCount = DataSet.GetSignaturesCount(NULL); 
   if (uSignaturesCount == 0)
   {
      ::MessageBox(NULL,
                   "No Digital Signatures in the main Data Set.",
                   "Sample",
                   MB_OK);
      return;
   }

   L_CHAR szMsg[128];

   if (uSignaturesCount == 1)
   {
      lstrcpy(szMsg, 
              "There is 1 Digital Signature in the main Data Set. "
              "Do you want to examine it?"); 
   }
   else
   {
      wsprintf(szMsg, 
               "There are %lu Digital Signatures in the main Data Set. "
               "Do you want to examine them?", uSignaturesCount); 
   }
   if (::MessageBox(NULL, szMsg, "Sample", MB_YESNO) != IDYES) 
   {
      return; 
   }

   for (L_UINT32 i = 0; i < uSignaturesCount; i++)
   {
      // Refer to the example of LDicomDS::VerifySignature for the
      // function ExamineSignature
      ExamineSignature(DataSet, DataSet.GetSignature(NULL, i)); 
   }
}