bool doGetCertificate(PluginInstance *obj, NPVariant *result) {
	LOG_LOCATION;
	FAIL_IF_NOT_ALLOWED_SITE;    
	char selectedCertID[33];
	int dlg_result = 0;
	
	dlg_result = promptForCertificate(getNativeWindowHandle(obj), selectedCertID);

	EstEID_log("Certificate selection dialog result = %i", dlg_result);
	EstEID_log("Selected certificate ID = %s", selectedCertID);

	if(dlg_result == IDCANCEL) {
		sprintf(EstEID_error, "User canceled");
		EstEID_errorCode = ESTEID_USER_CANCEL;
		EstEID_log("EstEID_error = %s", EstEID_error);
		browserFunctions->setexception(&obj->header, EstEID_error);	
		return false;
	}
	
	CertInstance *certInstance = (CertInstance *)browserFunctions->createobject(obj->npp, certClass());
	certInstance->npp = obj->npp;
	certInstance->certInfo = EstEID_mapClone(EstEID_getNonRepudiationCertById(selectedCertID));
//	certInstance->certInfo = EstEID_mapClone(EstEID_getNonRepudiationCert());

	EstEID_log("certObject=%p", certInstance);
	OBJECT_TO_NPVARIANT((NPObject *)certInstance, *result);
	EstEID_log("result=%p", result);	
	return true;
}
Ejemplo n.º 2
0
bool doGetCertificate(PluginInstance *obj, NPVariant *result) {
	LOG_LOCATION;
	FAIL_IF_NOT_ALLOWED_SITE;
	char selectedCertID[33];
	int dlg_result = 0;
	
#ifdef _WIN32
	HWND ownerWindowHandle = (HWND)getNativeWindowHandle(obj);
	EstEID_log("owner window handle passed to DialogBoxParam() = %08X", ownerWindowHandle);
	dlg_result = (int)DialogBoxParam(pluginInstance, MAKEINTRESOURCE(IDD_CERTIFICATESELECTIONDLG), ownerWindowHandle, CertSelectionDialogProc, (LPARAM)selectedCertID);
#else
	dlg_result = promptForCertificate(getNativeWindowHandle(obj), selectedCertID);
#endif
	EstEID_log("Certificate selection dialog result = %i", dlg_result);
	EstEID_log("Selected certificate ID = %s", selectedCertID);

	if(dlg_result == IDCANCEL) {
		sprintf(EstEID_error, "User canceled");
		EstEID_errorCode = ESTEID_USER_CANCEL;
		EstEID_log("EstEID_error = %s", EstEID_error);
		browserFunctions->setexception(&obj->header, EstEID_error);	
		return false;
	}
	
	CertInstance *certInstance = (CertInstance *)browserFunctions->createobject(obj->npp, certClass());
	certInstance->npp = obj->npp;
	certInstance->certInfo = EstEID_mapClone(EstEID_getNonRepudiationCertById(selectedCertID));
//	certInstance->certInfo = EstEID_mapClone(EstEID_getNonRepudiationCert());

	EstEID_log("certObject=%p", certInstance);
	OBJECT_TO_NPVARIANT((NPObject *)certInstance, *result);
	EstEID_log("result=%p", result);	
	return true;
}