public DigitalSignatureVerificationResult VerifySignature(DigitalSignatureVerificationArguments arguments)
        {
            var res = new DigitalSignatureVerificationResult();

            try
            {
                var rsaProviderSender = new RSACryptoServiceProvider();
                rsaProviderSender.FromXmlString(arguments.PublicKeyForSignatureVerification.ToString());
                var deformatter = new RSAPKCS1SignatureDeformatter(rsaProviderSender);
                deformatter.SetHashAlgorithm(_hashingService.HashAlgorithmCode());
                var hashResult = _hashingService.Hash(arguments.CipherText);
                res.SignaturesMatch = deformatter.VerifySignature(hashResult.HashedBytes, arguments.Signature);
                if (res.SignaturesMatch)
                {
                    var rsaProviderReceiver = new RSACryptoServiceProvider();
                    rsaProviderReceiver.FromXmlString(arguments.FullKeyForDecryption.ToString());
                    var decryptedBytes = rsaProviderReceiver.Decrypt(Convert.FromBase64String(arguments.CipherText), false);
                    res.DecodedText = Encoding.UTF8.GetString(decryptedBytes);
                }

                res.Success = true;
            }
            catch (Exception ex)
            {
                res.ExceptionMessage = ex.Message;
            }

            return(res);
        }
        public DigitalSignatureVerificationResult VerifySignature(DigitalSignatureVerificationArguments arguments)
        {
            var res = new DigitalSignatureVerificationResult();
            try
            {
                var rsaProviderSender = new RSACryptoServiceProvider();
                rsaProviderSender.FromXmlString(arguments.PublicKeyForSignatureVerification.ToString());
                var deformatter = new RSAPKCS1SignatureDeformatter(rsaProviderSender);
                deformatter.SetHashAlgorithm(_hashingService.HashAlgorithmCode());
                var hashResult = _hashingService.Hash(arguments.CipherText);
                res.SignaturesMatch = deformatter.VerifySignature(hashResult.HashedBytes, arguments.Signature);
                if (res.SignaturesMatch)
                {
                    var rsaProviderReceiver = new RSACryptoServiceProvider();
                    rsaProviderReceiver.FromXmlString(arguments.FullKeyForDecryption.ToString());
                    var decryptedBytes = rsaProviderReceiver.Decrypt(Convert.FromBase64String(arguments.CipherText), false);
                    res.DecodedText = Encoding.UTF8.GetString(decryptedBytes);
                }

                res.Success = true;
            }
            catch (Exception ex)
            {
                res.ExceptionMessage = ex.Message;
            }

            return res;
        }