La signature et la vérification des signatures RSA C#

J'ai récemment posté sur les problèmes rencontrés avec le chiffrement de données de grande taille avec le RSA, je suis enfin terminé et je suis maintenant de passer à la mise en œuvre de la signature avec la clé privée d'un utilisateur et de vérifier avec la clé publique correspondante. Cependant, chaque fois que je compare les données signées et le message d'origine en gros, je viens d'obtenir false est retourné. Je suis en espérant que certains de vos pu voir ce que je fais de mal.

Voici le code:

public static string SignData(string message, RSAParameters privateKey)
    {
        ////The array to store the signed message in bytes
        byte[] signedBytes;
        using (var rsa = new RSACryptoServiceProvider())
        {
            ////Write the message to a byte array using UTF8 as the encoding.
            var encoder = new UTF8Encoding();
            byte[] originalData = encoder.GetBytes(message);

            try
            {
                ////Import the private key used for signing the message
                rsa.ImportParameters(privateKey);

                ////Sign the data, using SHA512 as the hashing algorithm 
                signedBytes = rsa.SignData(originalData, CryptoConfig.MapNameToOID("SHA512"));
            }
            catch (CryptographicException e)
            {
                Console.WriteLine(e.Message);
                return null;
            }
            finally
            {
                ////Set the keycontainer to be cleared when rsa is garbage collected.
                rsa.PersistKeyInCsp = false;
            }
        }
        ////Convert the a base64 string before returning
        return Convert.ToBase64String(signedBytes);
    }

C'est donc la première étape, pour signer les données, ensuite, j'ai passer à la vérification des données:

public static bool VerifyData(string originalMessage, string signedMessage, RSAParameters publicKey)
    {
        bool success = false;
        using (var rsa = new RSACryptoServiceProvider())
        {
            byte[] bytesToVerify = Convert.FromBase64String(originalMessage);
            byte[] signedBytes = Convert.FromBase64String(signedMessage);
            try
            {
                rsa.ImportParameters(publicKey);

                SHA512Managed Hash = new SHA512Managed();

                byte[] hashedData = Hash.ComputeHash(signedBytes);

                success = rsa.VerifyData(bytesToVerify, CryptoConfig.MapNameToOID("SHA512"), signedBytes);
            }
            catch (CryptographicException e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                rsa.PersistKeyInCsp = false;
            }
        }
        return success;
    }

Et voici le test client:

public static void Main(string[] args)
    {
        PublicKeyInfrastructure pki = new PublicKeyInfrastructure();
        Cryptograph crypto = new Cryptograph();
        RSAParameters privateKey = crypto.GenerateKeys("[email protected]");

        const string PlainText = "This is really sent by me, really!";

        RSAParameters publicKey = crypto.GetPublicKey("[email protected]");

        string encryptedText = Cryptograph.Encrypt(PlainText, publicKey);

        Console.WriteLine("This is the encrypted Text:" + "\n " + encryptedText);

        string decryptedText = Cryptograph.Decrypt(encryptedText, privateKey);

        Console.WriteLine("This is the decrypted text: " + decryptedText);

        string messageToSign = encryptedText;

        string signedMessage = Cryptograph.SignData(messageToSign, privateKey);

        ////Is this message really, really, REALLY sent by me?
        bool success = Cryptograph.VerifyData(messageToSign, signedMessage, publicKey);

        Console.WriteLine("Is this message really, really, REALLY sent by me? " + success);

    }

Ai-je raté une étape? Selon l'API de chiffrement et d'exemples là, je ne devrais pas calculer manuellement toutes les tables de hachage, depuis que je l'approvisionnement de l'algorithme dans l'appel de la méthode elle-même.

Toute aide sera grandement appréciée.