Howto create X509Certificate2 instance from a certificate imported into db?

Hi,
please, I was imported X.509 certificate from the .cer file into a database, using command:
CREATE CERTIFICATE FROM FILE='c:\temp\testCert.cer';

After this, I found this certificate in the sys.certificates view.
Now I want to write managed user defined function (.net managed code), which uses the certificate. I want to create instance of X509Certificate2 class, but i dont know how.

In the SQL Server 2005 documentation, I found only Microsoft.SqlServer.Management.Smo.Certificate class, but there isn't any relation (an method or property) to X509Certificate2 class.

Is the certificate stored in some windows certificate store? Or is there an undocumented table, where is the certificate serialized, and I can deserialize it and create instance of the X509Certificate2 class?

Thanks in advance.
Fipil.

[977 byte] By [Fipil] at [2008-2-27]
# 1
The certificate is stored in an internal table that is not exposed. If you want to access the certificate bits, you may try to back it up to a temporary file.

Thanks
Laurentiu

LaurentiuCristofor at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Security...

SQL Server

Site Classified