viewing certificate services database
Date: 05/20/05
(C Sharp) Keywords: database, asp, security, web, microsoft
Hello All!
I need to have access to certificate services database from the c# web application. Approach described in msdn lib(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/viewing_the_certificate_services_database.asp) does not seem to work. Or maybe i can't understand what the realy mean...
certadm.dll doesn't provide class implementation for IEnumCERTVIEWROW, IEnumCERTVIEWATTRIBUTE and IEnumCERTVIEWEXTENTION. Interface is an abstract entity as far as i know. (Unfortunately i don't know much...) So, how can one (as "ICertView::OpenView creates a IEnumCERTVIEWROW object") create an instance of an interface object with no corresponding class?
One version of my code looks something like this:
CERTADMINLib.IEnumCERTVIEWROW cvr;
CERTADMINLib.IEnumCERTVIEWATTRIBUTE cva;
CERTADMINLib.CCertViewClass CertView = new CERTADMINLib.CCertViewClass();
CertView.OpenConnection("pcitis31.cert.cern\\CERTSubCA");
CertView.SetTable(0);
CertView.SetResultColumnCount(-2);
cvr = CertView.OpenView();
cva = cvr.EnumCertViewAttribute(0); //-here i get COMException with 0x8000ffff code (Catastrophic failure)
Am i missing something, or am i absolutely on the wrong way?
Examples shown in msdn are quite similar(but in vb):
ex.1
' Declare the IEnumCERTVIEWROW object variable.
Dim objRow As IEnumCERTVIEWROW
' Instantiate the row object.
Set objRow = objView.OpenView
' Use the object as needed.
' When done processing, free the object.
Set objRow = Nothing
ex.2
' Initialize an IEnumCERTVIEWCOLUMN object.
Dim objCol As IEnumCERTVIEWCOLUMN
Set objCol = objRow.EnumCertViewColumn()
' Use objCol as needed.
' ...
' Free objCol when done.
Set objCol = Nothing
Any help, ideas are very much appreciated!
Thanks in advance!
Source: http://www.livejournal.com/community/csharp/29256.html