Пример #1
0
        private void _btn_Verify_Click(object sender, EventArgs e)
        {
            if (Utils.VerifyOpensslVersion(this) == false)
            {
                return;
            }

            EnableControls(false);

            try
            {
                string sDataSet = _txBx_DataSet.Text;

                DicomDataSet DataSet = new DicomDataSet();

                // Load the Data Set
                DataSet.Load(sDataSet, DicomDataSetLoadFlags.LoadAndClose);
                WaitCursor waitCursor = new WaitCursor();

                // Get the Digital Signature Count
                int iCount = DataSet.GetSignaturesCount(null);
                if (iCount < 1)
                {
                    MessageBox.Show("There are no digital signatures in this DICOM data set.", "Demo");
                }
                else
                {
                    // Verify all the Digital Signatures in the whole Data Set
                    bool bRet = DataSet.VerifySignature(null);
                    if (bRet == true)
                    {
                        string szMsg = string.Format("There are {0} digital signatures, and all were verified", iCount);
                        MessageBox.Show(szMsg, "Demo");
                    }
                    else
                    {
                        string szMsg = string.Format("Failed to verify the Digital Signatures");
                        MessageBox.Show("Failed to verify the Digital Signatures", "Demo");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failed");
            }
            finally
            {
                EnableControls();
            }
        }