Creating a Digital Signature Example for VB.NET

Sub CreateSignature(ByRef objDS As LTDICLib.LEADDicomDS)
   Dim nRet As Short

   ' Create a Digital Signature in the main Data Set
   objDS.SetCurrentElement(0)
   nRet = objDS.CreateSignature("C:\PrivateKey", "C:\Certificate.cer", "")
   If nRet = LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS Then
      MessageBox.Show("The Digital Signature was created successfully.", "Sample")
   Else
      MessageBox.Show("An error occurred [Error: " & nRet & "].", "Sample")
      Exit Sub
   End If

   ' 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.CurrentElement.hElement)
End Sub