Creating a Digital Signature Example for C++ 6.0 and later
void CreateSignature(ILEADDicomDSPtr& spDicomDS)
{
// Create a Digital Signature in the main Data Set
spDicomDS->SetCurrentElement(0);
short nRet = spDicomDS->CreateSignature("C:\\PrivateKey",
"C:\\Certificate.cer",
"",
"",
DICOM_MAC_ALGORITHM_RIPEMD160,
VARIANT_FALSE,
DICOM_SECURITY_PROFILE_NONE,
0);
if (nRet == DICOM_SUCCESS)
{
::MessageBox(NULL,
"The Digital Signature was created successfully.",
"Sample",
MB_OK);
}
else
{
char szMsg[64];
wsprintf(szMsg, "An error occurred [Error: %hd].", nRet);
::MessageBox(NULL, szMsg, "Sample", MB_OK);
return;
}
// Save the signed Data Set
spDicomDS->SaveDS("C:\\Signed.dic", 0);
// Examine the Digital Signature we just created
// Refer to Examining a Digital Signature Example for C++ 6.0 and later
// for the function ExamineSignature
ExamineSignature(spDicomDS, spDicomDS->GetCurrentElement()->hElement);
}