News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Bug during garbage collection....  
by Gareth [sluglit at hotmail dot com]
posted on 2004/03/15

I have found a bug in the Certificate object.

After deleting a certificate from a Certificate store an exception is thrown in the finalize method of the certificate object

Here's what I'm doing :
1. Create a certificate request with exportable private keys.
2. Then open the Request certificate store.
3. Get the certificate request from the request store.
4. Save the certificate to disk .
5. Delete the certificte from the request store.

6. Program ends and garbage collection cleans up everything.
7. Exception is thrown from the Certificates finalize object...

Below is example code :
CertificateStore store = new CertificateStore("REQUEST");
Certificate c = store.FindCertificateBySubjectName(myDN);


if(c != null)
{
System.Console.WriteLine("Retrieved request : " + c.GetName());
FileInfo file = new FileInfo("c:\\cert1.pfx");

if(file.Exists) file.Delete();

System.Console.WriteLine("Saving request : " + file.FullName);

c.ToPfxFile(file.FullName, "password", true, true);

System.Console.WriteLine("Deleting request : " + file.FullName);

store.DeleteCertificate(c);
}




Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at Org.Mentalis.Security.SspiProvider.CertFreeCertificateContext(IntPtr pCert
Context)
at Org.Mentalis.Security.Certificates.Certificate.Finalize()

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2004/03/17

Thanks for your post. We released a new version of the library that fixes this bug. You can download it from http://mentalis.org/soft/projects/seclib/download.qpx

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.