473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

API is taking time ....

I am trying to fetch public key from DSA certificate using .NET
cryptography API. It is taking 15 to 45 seconds.....
Expand|Select|Wrap|Line Numbers
  1.        String crtFileName = "C:\mycert.crt";
  2.  
  3.         X509Certificate2 x509 = new X509Certificate2();
  4.  
  5.         byte[] rawData = System.IO.File.ReadAllBytes(crtFileName);
  6.         x509.Import(rawData);
  7.  
  8.         // START
  9.         DateTime tm = DateTime.Now;
  10.         DSACryptoServiceProvider dsa1 = (DSACryptoServiceProvider)
  11. x509.PublicKey.Key; // TAKING 15 to 45 SECONDS
  12.         TimeSpan ts = DateTime.Now - tm ;
  13.         Console.WriteLine("Extract Public Key : " + ts.ToString
  14. ());
  15.         // END
  16.  
  17.         HashAlgorithm hashAlgo = HashAlgorithm.Create("SHA1");
  18.         byte[] hash = hashAlgo.ComputeHash(data_to_sign);
  19.         bool bVar = dsa1.VerifySignature(hash, signature);
  20.  
Help me to find why API is taking time... ?
Jan 29 '09 #1
1 1801
Hi, try to do this:

X509Certificate2 cert = new X509Certificate2(crtFileName);
DSASignatureDeformatter deformatter = new DSASignatureDeformatter(cert.PublicKey.Key);
...
bool ok = deformatter.VerifySignature(hash, signature);

I tried with the RSA algorithm and it works well. I doesn't have DSA certificate and so I cannot try it. Are you sure your certificate is well done ... ?

If you need some RSA certificate to test you can create them at http://www.we-coffee.com/x509builder.aspx
Sep 26 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kumar | last post by:
Need urgent help... I am trying to make a change in one column (primary key). I dropped the primary key which dropped other 2-3 foreign keys referencing this column. I made the changes. ...
0
by: anshu | last post by:
Hi, I've to migrate an existing code in asp to asp.Net. The asp code uses ServerXMLHTTP to call some services. Same thing will be done using HttpWebRequest in the asp.Net code. The problem is...
1
by: thomson | last post by:
Hi all, I have created a Web Application in my system, This application is accessed only in the local network. I have observed that in some machine When there is a post back it will be taking...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
3
by: Jim Langston | last post by:
I really am not sure if this question belongs in this newsgroup, but not sure where else to ask it. There is someone working on a game that I tested, and it was taking >30 seconds to load. He...
3
by: jmark | last post by:
I have PHP 5.2.1 running on Windows XP home. The problem I have is that programs run in the command line are taking more than 10 minutes to exit. Does anyone know a solution to this?
2
by: Kumarswamy | last post by:
Hi, I have a problem, i have used one condition in where clause ..... but it is taking some time to return values....... so my procedure is taking lot of time....... for the same table if i query...
6
by: Gouri.Mahajan7 | last post by:
Hello, When I press the button on the web page I am loading the user control on the web page. This user control is invoking some methods of the web service. The control on the web page is loaded...
4
by: eliane | last post by:
For some reason, DB2 is taking a long time to start archiving the logs. Pls, do you know what could be causing it? I see the following msgs on db2diag.log 2008-09-04-00.36.24.414103+000...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.