Creating a Digital Signature Example for C#
public void CreateSignature(ref LTDICLib.LEADDicomDS objDS)
{
short nRet = 0;
// Create a Digital Signature in the main Data Set
objDS.SetCurrentElement(0);
nRet = objDS.CreateSignature("C:\\PrivateKey",
"C:\\Certificate.cer", "", "", LTDICLib.DicomMacAlgorithm.DICOM_MAC_ALGORITHM_RIPEMD160,
false, LTDICLib.DicomSecurityProfile.DICOM_SECURITY_PROFILE_NONE, 0);
if (nRet == (short)LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS)
MessageBox.Show("The Digital Signature was created successfully.",
"Sample");
else
{
MessageBox.Show("An error occurred [Error: " + nRet + "].",
"Sample");
return;
}
// Save the signed Data Set
objDS.SaveDS("C:\\Signed.dic",
0);
// Examine the Digital Signature we just created
// Refer to Examining a Digital Signature Example
// for the procedure ExamineSignature
ExamineSignature(objDS, objDS.get_CurrentElement().hElement);
}