Up to now I have the code below which I borrowed from Firefox to do the conversion. I hope it works for me, I will let everybody know later.
My ultimate goal is to extract the value of one of the X509 extensions of the certificate (SUBJECT ALT NAME). nsIX509Cert does not seem to have a way to do this. Can somebody please correct me if I am wrong? Is there any way to extract the X509 extension's value from a nsIX509Cert object without converting to CERTCertificate first? Thanks ///////////////////////////////////////////////////////////////// // certToShow is nsIX509Cert SECItem der; CERTCertificate *peerCert rv=certToShow->GetRawDER(&der.len, (PRUint8 **)&der.data); if (NS_FAILED(rv)) return rv; CERTCertificate *tmpCert; CERTCertDBHandle *certdb = CERT_GetDefaultCertDB(); tmpCert = CERT_FindCertByDERCert(certdb, &der); if (!tmpCert) { tmpCert = CERT_NewTempCertificate(certdb, &der, nsnull, PR_FALSE, PR_TRUE); } nsMemory::Free(der.data); der.data = nsnull; der.len = 0; if (!tmpCert) { NS_ERROR("Couldn't create cert from DER blob\n"); return NS_ERROR_FAILURE; } ///////////////////////////////////////////////////////////////// On Aug 16, 8:47 pm, Mark <[EMAIL PROTECTED]> wrote: > Hi, > > Is there any way to convert an nsIX509Cert* to nsNSSCertificate *? > > Or, does nsIX509Cert has a function similar to "GetCert" of > nsNSSCertificate? If not, gow can I convert from to nsIX509Cert* to > CERTCertificate*? > > The issue is that for the ConfirmMismatchDomain event, an instance of > nsIX509Cert* is passed, but I need to get its info on the form of > CERTCertificate * > > Any help would be greatly appreciated > > Thanks in advance > > P.S. How can I use the class nsNSSCertificate? Even if I add pipnss as > a dependence of my component (REQUIRES variable) and $(NSS_LIBS) as > part of EXTRA_DSO_LDOPTS, libpipnss.so is not being linked and I > receive an error if I try to use the method GetCert: > > undefined reference to `nsNSSCertificate::GetCert()' _______________________________________________ dev-tech-xpcom mailing list dev-tech-xpcom@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-xpcom