I am trying to fetch public key from DSA certificate using .NET
cryptography API. It is taking 15 to 45 seconds.....
Help me to find why API is taking time... ?
cryptography API. It is taking 15 to 45 seconds.....
Code:
String crtFileName = "C:\mycert.crt";
X509Certificate2 x509 = new X509Certificate2();
byte[] rawData = System.IO.File.ReadAllBytes(crtFileName);
x509.Import(rawData);
// START
DateTime tm = DateTime.Now;
DSACryptoServiceProvider dsa1 = (DSACryptoServiceProvider)
x509.PublicKey.Key; // TAKING 15 to 45 SECONDS
TimeSpan ts = DateTime.Now - tm ;
Console.WriteLine("Extract Public Key : " + ts.ToString
());
// END
HashAlgorithm hashAlgo = HashAlgorithm.Create("SHA1");
byte[] hash = hashAlgo.ComputeHash(data_to_sign);
bool bVar = dsa1.VerifySignature(hash, signature);
Comment