string GenerateSignature(IOAuthContext authContext, SigningContext signingContext)
        {
            if (signingContext.Algorithm == null)
            {
                throw Error.AlgorithmPropertyNotSetOnSigningContext();
            }

            SHA1CryptoServiceProvider sha1 = GenerateHash(signingContext);

            var formatter = new RSAPKCS1SignatureFormatter(signingContext.Algorithm);

            formatter.SetHashAlgorithm("MD5");

            byte[] signature = formatter.CreateSignature(sha1);

            return(Convert.ToBase64String(signature));
        }
        public bool ValidateSignature(IOAuthContext authContext, SigningContext signingContext)
        {
            if (signingContext.Algorithm == null)
            {
                throw Error.AlgorithmPropertyNotSetOnSigningContext();
            }

            SHA1CryptoServiceProvider sha1 = GenerateHash(signingContext);

            var deformatter = new RSAPKCS1SignatureDeformatter(signingContext.Algorithm);

            deformatter.SetHashAlgorithm("MD5");

            byte[] signature = Convert.FromBase64String(authContext.Signature);

            return(deformatter.VerifySignature(sha1, signature));
        }