Home All Groups Group Topic Archive Search About

API is taking time....

Author
29 Jan 2009 7:06 AM
Anuj
Hi All,

I am trying to fetch public key from DSA certification using .NET
cryptography AP. It is taking 15 to 45 seconds.....

       String crtFileName = "C:\mycert.cer";

        X509Certificate2 x509 = new X509Certificate2();

        byte[] rawData = System.IO.File.ReadAllBytes(crtFileName);
        x509.Import(rawData);


        // START
        DateTime dtFaq = DateTime.Now;
        DSACryptoServiceProvider dsa1 = (DSACryptoServiceProvider)
x509.PublicKey.Key; // TAKING 15 to 45 SECONDS
        TimeSpan tsFaq = DateTime.Now - dtFaq;
        Console.WriteLine("Extract Public Key : " + tsFaq.ToString
());
        // END

        HashAlgorithm hashAlgo = HashAlgorithm.Create("SHA1");
        byte[] hash = hashAlgo.ComputeHash(data_to_sign);
        bool bVar = dsa1.VerifySignature(hash, signature);

Help me to find why API is taking time... ?

Author
20 Feb 2009 2:00 PM
Eusebiu
Hello...
Just a sugestion.. use CLR profier...
http://msdn.microsoft.com/en-us/library/ms979205.aspx

Hope it helps...