private void verifyText(string inputText)
        {
            IPrivKey publicKey = null;

            try
            {
                publicKey = IPriv.openPublicKey(m_Configuration.PublicKeyPath, Convert.ToUInt32(m_Configuration.PublicKeySerial, 10));
                publicKey.verifyText(inputText); // If this step is successfull, then signature is valid
            }
            catch (IPrivException err)
            {
                throw new CryptographicException(err + " (код ошибки = " + err.code + ")", err);
            }
            finally
            {
                publicKey?.closeKey();
            }
        }
示例#2
0
        private bool VerifySign(string message)
        {
            var      res = false;
            IPrivKey pub = null;

            try
            {
                pub = IPriv.openPublicKey(PublicKey, Convert.ToUInt32(SerialNumber, 10));
                pub.verifyText(message);
                Functions.AddEvent("Signature valid!",
                                   string.Format("VerifySign: [{0}]", message), EventType.Info);
                res = true;
            }
            catch (IPrivException ex)
            {
                Functions.AddEvent("Error during signature verification!", string.Format("VerifySign!: [{0}]", ex.Message), EventType.Critical, null, ex);
            }
            if (pub != null)
            {
                pub.closeKey();
            }
            return(res);
        }