public DigitalSignatureCreationResult Sign(DigitalSignatureCreationArguments arguments)
        {
            var res = new DigitalSignatureCreationResult();

            try
            {
                var rsaProviderReceiver = new RSACryptoServiceProvider();
                rsaProviderReceiver.FromXmlString(arguments.PublicKeyForEncryption.ToString());
                var encryptionResult = rsaProviderReceiver.Encrypt(Encoding.UTF8.GetBytes(arguments.Message), false);
                var hashed           = _hashingService.Hash(Convert.ToBase64String(encryptionResult));

                var rsaProviderSender = new RSACryptoServiceProvider();
                rsaProviderSender.FromXmlString(arguments.FullKeyForSignature.ToString());
                var signatureFormatter = new RSAPKCS1SignatureFormatter(rsaProviderSender);
                signatureFormatter.SetHashAlgorithm(_hashingService.HashAlgorithmCode());
                var signature = signatureFormatter.CreateSignature(hashed.HashedBytes);

                res.Signature  = signature;
                res.CipherText = Convert.ToBase64String(encryptionResult);
                res.Success    = true;
            }
            catch (Exception ex)
            {
                res.ExceptionMessage = ex.Message;
            }

            return(res);
        }
        public DigitalSignatureCreationResult Sign(DigitalSignatureCreationArguments arguments)
        {
            var res = new DigitalSignatureCreationResult();
            try
            {
                var rsaProviderReceiver = new RSACryptoServiceProvider();
                rsaProviderReceiver.FromXmlString(arguments.PublicKeyForEncryption.ToString());
                var encryptionResult = rsaProviderReceiver.Encrypt(Encoding.UTF8.GetBytes(arguments.Message), false);
                var hashed = _hashingService.Hash(Convert.ToBase64String(encryptionResult));

                var rsaProviderSender = new RSACryptoServiceProvider();
                rsaProviderSender.FromXmlString(arguments.FullKeyForSignature.ToString());
                var signatureFormatter = new RSAPKCS1SignatureFormatter(rsaProviderSender);
                signatureFormatter.SetHashAlgorithm(_hashingService.HashAlgorithmCode());
                var signature = signatureFormatter.CreateSignature(hashed.HashedBytes);

                res.Signature = signature;
                res.CipherText = Convert.ToBase64String(encryptionResult);
                res.Success = true;
            }
            catch (Exception ex)
            {
                res.ExceptionMessage = ex.Message;
            }

            return res;
        }