本文整理汇总了C++中EstEID_log函数的典型用法代码示例。如果您正苦于以下问题:C++ EstEID_log函数的具体用法?C++ EstEID_log怎么用?C++ EstEID_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EstEID_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EstEID_log
void *getNativeWindowHandle(PluginInstance *obj) {
void *nativeWindowHandle = obj->nativeWindowHandle;
#ifdef _WIN32
EstEID_log("_WIN32 detected, forcing nativeWindowHandle query from browser");
nativeWindowHandle = 0;
#endif
if (!nativeWindowHandle) {
browserFunctions->getvalue(obj->npp, NPNVnetscapeWindow, &nativeWindowHandle);
EstEID_log("reading nativeWindowHandle=%p from browserFunctions", nativeWindowHandle);
}
else {
EstEID_log("reading nativeWindowHandle=%p from PluginInstance", nativeWindowHandle);
}
return nativeWindowHandle;
}
示例2: EstEID_getSlotId
int EstEID_getSlotId(char* certId, CK_SLOT_ID* slotId) {
int certIndex;
EstEID_Certs *certs = EstEID_loadCerts();
EstEID_log("certs loaded");
if (!certs) {
EstEID_log("%s", EstEID_error);
return FALSE;
}
else if ((certIndex = EstEID_findNonRepuditionCert(certs, certId)) == NOT_FOUND) {
EstEID_log("card is changed");
return FALSE;
}
*slotId = certs->slotIDs[certIndex];
return TRUE;
}
示例3: CertOpenStore
void CEstEIDCertificate::readFromCertContext() {
LOG_LOCATION;
PCCERT_CONTEXT pCertContext = NULL;
HCERTSTORE hCertStore = NULL;
CRYPTUI_SELECTCERTIFICATE_STRUCT sel = {sizeof(sel)};
int counter = 0;
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG, L"MY");
if(!hCertStore){
throw CryptoException();
}
sel.pvCallbackData = &counter;
sel.pFilterCallback = filter_proc;
sel.rghDisplayStores = &hCertStore;
sel.cDisplayStores = 1;
#ifdef _SEB_BUILD
EstEID_log("SEB build");
PCCERT_CONTEXT pCertContextForEnumeration = NULL;
int certificatesCount = 0;
while(pCertContextForEnumeration = CertEnumCertificatesInStore(hCertStore, pCertContextForEnumeration)) {
if(isValidForSigning(pCertContextForEnumeration)) {
certificatesCount++;
pCertContext = pCertContextForEnumeration;
}
}
EstEID_log("Certificates count %i", certificatesCount);
if(certificatesCount != 1) {
pCertContext = CryptUIDlgSelectCertificate(&sel);
}
#else
pCertContext = CryptUIDlgSelectCertificate(&sel);
#endif
if(!pCertContext) {
EstEID_log("User didn't select sertificate");
throw CryptoException(ESTEID_USER_CANCEL);
}
loadCertContexts(pCertContext);
if(pCertContext){
CertFreeCertificateContext(pCertContext);
}
if(hCertStore) {
CertCloseStore(hCertStore, CERT_CLOSE_STORE_FORCE_FLAG);
}
}
示例4: EstEID_logInitInfo
void EstEID_logInitInfo(CK_INFO info) {
char *libraryDescription = EstEID_createString(info.libraryDescription, 32);
char *manufacturerID = EstEID_createString(info.manufacturerID, 32);
EstEID_log("cryptoki %i.%i, library %i.%i %s, %s", info.cryptokiVersion.major, info.cryptokiVersion.minor, info.libraryVersion.major, info.libraryVersion.minor, libraryDescription, manufacturerID);
free(libraryDescription);
free(manufacturerID);
}
示例5: EstEID_isPinPad
int EstEID_isPinPad(CK_SLOT_ID slotID) {
CK_TOKEN_INFO tokenInfo;
if (EstEID_CK_failure("C_GetTokenInfo", fl->C_GetTokenInfo(slotID, &tokenInfo))) return 0;
EstEID_log("flags: %li (%lx)", tokenInfo.flags, tokenInfo.flags);
if (tokenInfo.flags & CKF_PROTECTED_AUTHENTICATION_PATH) return 1;
else return 0;
}
示例6: EstEID_pinPadLogin
THREAD_RETURN_TYPE EstEID_pinPadLogin(void* threadData) {
#ifndef _WIN32
LOG_LOCATION;
pthread_mutex_lock(&pinpad_thread_mutex);
CK_SESSION_HANDLE session = ((EstEID_PINPadThreadData*)threadData)->session;
CK_RV loginResult = fl->C_Login(session, CKU_USER, NULL, 0);
((EstEID_PINPadThreadData*)threadData)->result = loginResult;
closePinPadModalSheet();
EstEID_log("modal sheet/dialog destroyed");
pinpad_thread_completed = TRUE;
pthread_cond_broadcast(&pinpad_thread_condition);
pthread_mutex_unlock(&pinpad_thread_mutex);
pthread_exit(NULL);
#else
EstEID_PINPromptDataEx* pinPromptDataEx;
LOG_LOCATION;
WaitForSingleObject(pinpad_thread_mutex, INFINITE);
pinPromptDataEx = (EstEID_PINPromptDataEx*)threadData;
pinPromptDataEx->pinPromptData.promptFunction(NULL, pinPromptDataEx->name, pinPromptDataEx->message, 0, TRUE);
ReleaseMutex(pinpad_thread_mutex);
return TRUE;
#endif
}
示例7: EstEID_logBase64
void EstEID_logBase64(char *message, char* data, int dataLength) {
char *base64;
LOG_LOCATION;
base64 = EstEID_base64Encode(data, dataLength);
EstEID_log(message, base64);
free(base64);
}
示例8: PinPadDialogProc
INT_PTR CALLBACK PinPadDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch(message) {
case WM_INITDIALOG:
dialogWindowHandle = hwnd;
SetPinDialogLabels(dialogWindowHandle, lParam);
SetDialogItemText(hwnd, IDC_PINPAD_PIN2_LABEL, l10n("For signing enter PIN2 from PIN pad"));
countdownValue = 30; // in seconds
EstEID_log("initializing pinpad countdown timer with value %i", countdownValue);
SendMessage(GetDlgItem(dialogWindowHandle, IDC_PROGRESSBAR), PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0L);
SendMessage(GetDlgItem(dialogWindowHandle, IDC_PROGRESSBAR), PBM_SETRANGE, 0, MAKELPARAM(0, countdownValue));
UpdateProgerssBar(dialogWindowHandle, countdownValue);
SendMessage(GetDlgItem(dialogWindowHandle, IDC_PROGRESSBAR), PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0L);
SetTimer(dialogWindowHandle, 1, 1000, NULL);
break;
case WM_DESTROY:
KillCountdownTimer();
break;
case WM_TIMER:
CountdownTimerProc();
break;
case WM_CTLCOLORSTATIC:
if(GetDlgItem(hwnd, IDC_ERROR) == ((HWND)lParam)){
return SetMessageLabelColorToRed(wParam);
}
default:
return false;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例9: createAndFillModel
static GtkTreeModel* createAndFillModel() {
GtkListStore *certificatesList = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
GtkTreeIter iterator;
char *validTo = NULL;
EstEID_Certs *certs = EstEID_loadCerts();
EstEID_log("%i certificates found", certs->count);
for(int i = 0; i < certs->count; i++) {
EstEID_Map cert = certs->certs[i];
if (!EstEID_mapGet(cert, "usageNonRepudiation")) continue;
validTo = getDateFromDateTime(EstEID_mapGet(cert, "validTo"));
gtk_list_store_append(certificatesList, &iterator);
gtk_list_store_set(certificatesList, &iterator,
0, EstEID_mapGet(cert, "commonName"),
1, EstEID_mapGet(cert, "organizationName"),
2, validTo,
3, EstEID_mapGet(cert, "certHash"),
-1);
if(validTo) {
free(validTo);
validTo = NULL;
}
}
return GTK_TREE_MODEL(certificatesList);
}
示例10: promptForCertificate
int promptForCertificate(void *nativeWindowHandle, char* certId) {
certId[0] = '\0';
GtkWidget *window = getGtkWindow(nativeWindowHandle);
GtkWidget *dialog = gtk_dialog_new_with_buttons("Select certificate", GTK_WINDOW(window), // ToDo l10n
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
GtkWidget* certificatesView = createCertificateSelectionView(dialog);
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, FALSE);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), certificatesView);
setDialogProperties(dialog, window);
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
gtk_widget_show_all(dialog);
gint result = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
int returnValue = IDCANCEL;
if (result == GTK_RESPONSE_OK) {
GtkTreeSelection* selectedRow = gtk_tree_view_get_selection(GTK_TREE_VIEW(certificatesView));
GtkTreeModel* model = NULL;
GtkTreeIter iter;
if(gtk_tree_selection_get_selected(selectedRow, &model, &iter)){
gchar* id;
gtk_tree_model_get(model, &iter, 3, &id, -1);
strcpy(certId, id);
g_free(id);
returnValue = IDOK;
EstEID_log("promptForCertificate dialog returned cert ID %s", certId);
}
else {
EstEID_log("promptForCertificate dialog returned without cert selection");
}
}
else {
EstEID_log("promptForCertificate dialog canceled by user");
}
gtk_widget_destroy(dialog);
return returnValue;
}
示例11: certGetProperty
bool certGetProperty(CertInstance *obj, NPIdentifier name, NPVariant *variant) {
NPUTF8* nameString = browserFunctions->utf8fromidentifier(name);
EstEID_log("name=%s", (char *)nameString);
const char *result = EstEID_mapGet(obj->certInfo, EstEID_getCertPropertyName(nameString));
browserFunctions->memfree(nameString);
if (result) return copyStringToNPVariant(result, variant);
return false;
}
示例12: EstEID_tokensChanged
int EstEID_tokensChanged() {
LOG_LOCATION;
CK_SLOT_ID slotID;
int changed = FALSE;
while (fl->C_WaitForSlotEvent(CKF_DONT_BLOCK, &slotID, NULL_PTR) == CKR_OK) {
EstEID_log("C_WaitForSlotEvent() pass cycle 1");
changed = TRUE;
}
if (!changed) {
while (fl->C_WaitForSlotEvent(CKF_DONT_BLOCK, &slotID, NULL_PTR) == CKR_OK) {
EstEID_log("C_WaitForSlotEvent() pass cycle 2");
changed = TRUE;
}
}
EstEID_log("tokens change %sdetected", changed ? "" : "not ");
return changed;
}
示例13: EstEID_CK_failure
int EstEID_CK_failure(const char *name, CK_RV result) {
EstEID_clear_error();
if (result == CKR_OK || result == CKR_CRYPTOKI_ALREADY_INITIALIZED) return FAILURE;
sprintf(EstEID_error, "%s error: %s (%li)", name, pkcs11_error_message(result), result);
EstEID_errorCode = ESTEID_PKCS11_ERROR;
EstEID_log("cryptoki error: %s", EstEID_error);
return SUCCESS;
}
示例14: EstEID_log
char *EstEID_sign(char *certId, char *hash, EstEID_PINPromptData pinPromptData) {
EstEID_log("called, hash=%s", hash);
char *signature = NULL;
int i;
EstEID_log("calling EstEID_loadCerts()");
EstEID_Certs *certs = EstEID_loadCerts();
EstEID_log("certs loaded");
if (!certs) {
EstEID_log("%s", EstEID_error);
}
else if ((i = EstEID_findNonRepuditionCert(certs, certId)) == NOT_FOUND) {
snprintf(EstEID_error, sizeof(EstEID_error) - 1, "no cert has ID: %s", certId);
EstEID_errorCode = ESTEID_CERT_NOT_FOUND_ERROR;
EstEID_error[sizeof(EstEID_error) - 1] = 0;
EstEID_log("%s", EstEID_error);
}
else if (EstEID_signHashHex(&signature, certs->slotIDs[i], certs->certs[i], hash, pinPromptData)) {
EstEID_log("signature=%s", signature);
}
else {
EstEID_log("%s", EstEID_error);
}
free(certId);
free(hash);
return signature;
}
示例15: EstEID_md5_failure
int EstEID_md5_failure(void *ptr) {
EstEID_clear_error();
if (ptr) return FALSE;
snprintf(EstEID_error, sizeof(EstEID_error) - 1, "Cert id creation failed");
EstEID_errorCode = ESTEID_MD5_ERROR;
EstEID_error[sizeof(EstEID_error) - 1] = 0;
EstEID_log("%s", EstEID_error);
return TRUE;
}