Google Answers Logo
View Question
 
Q: Trusted Certificates in IE ( No Answer,   2 Comments )
Question  
Subject: Trusted Certificates in IE
Category: Computers > Internet
Asked by: pootz-ga
List Price: $40.00
Posted: 04 Apr 2003 10:47 PST
Expires: 04 May 2003 11:47 PDT
Question ID: 186041
Hello,

Our program is installed through an Active X "Security Warning" asking
YES or NO.

We want a piece of code to add to our program that will automatically
add our Company in the "Trusted Certificates" of IE so that we can
upgrade the program without having to explain to the user that he has
to click YES again.

I am looking for that piece of code, in delphi if possible, or C++.
Or, any site that explains how to do this.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Trusted Certificates in IE
From: hammer-ga on 07 Apr 2003 08:29 PDT
 
Doesn't IE offer a checkbox on that screen that says "Always trust
content from this company"?

- Hammer
Subject: Re: Trusted Certificates in IE
From: romanmar-ga on 07 Apr 2003 12:59 PDT
 
Here is some code that maybe of use 2 u:  
I ripped it out of my Certificate Manager class:
Basically first function initializes, ie gets the handle, second one
actually adds the certificate, you must do it before you fire up your
IE instance.

// Initialize the testing certificate store and personal certificate
store

BOOL	CCertMgr::InitCertStore()
{
	// Testing store: myTestStore
	if (!(m_hCertStore = CertOpenStore(
			CERT_STORE_PROV_SYSTEM, //cert provider
			0, // not used
			NULL,//uses default crypt provider
			CERT_SYSTEM_STORE_CURRENT_USER, //specify system store registry
location
			L"myTestStore" // Store name as Unicode string
		)))
	{
		return FALSE;
	}

	// Personal store
	if ((m_hMyStore = CertOpenStore(
			CERT_STORE_PROV_SYSTEM,
			0,
			NULL,
			CERT_SYSTEM_STORE_CURRENT_USER,
			L"MY"// Opens System store
		)))
		return TRUE;

	return FALSE;
}
Here I add a certificate to do personal store
// Add the testing certificate to the personal store
BOOL	CCertMgr::AddCertToPersonalStore()
{
	BOOL		bAddOK = FALSE;

	if (m_hMyStore == NULL || m_pMyCert == NULL)
		return FALSE;

	
	bAddOK = CertAddCertificateContextToStore(m_hMyStore, m_pMyCert,
CERT_STORE_ADD_NEW, NULL);
		
	if (!bAddOK)
	{
		DWORD dwError = GetLastError();

		if (dwError == CRYPT_E_EXISTS)
			bAddOK = TRUE;
		else if (dwError == E_INVALIDARG)
			bAddOK = FALSE;
	}
	else
	{
		m_bNeedToDelete = TRUE;
	}
	
	return bAddOK;
}

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy