NetSurf
Data Structures | Macros | Functions | Variables
ssl_cert.c File Reference

Implementation of win32 certificate viewing using nsw32 core windows. More...

#include <stdint.h>
#include <stdlib.h>
#include <windows.h>
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "desktop/sslcert_viewer.h"
#include "windows/windbg.h"
#include "windows/plot.h"
#include "windows/corewindow.h"
#include "windows/gui.h"
#include "windows/resourceid.h"
#include "windows/ssl_cert.h"
Include dependency graph for ssl_cert.c:

Go to the source code of this file.

Data Structures

struct  nsw32_sslcert_window
 win32 ssl certificate view context More...
 

Macros

#define DLG_MRGN   11
 dialog margin More...
 
#define WRN_ICO_H   32
 warning icon height More...
 
#define CMD_BTN_W   75
 comand button width More...
 
#define CMD_BTN_H   23
 command button height More...
 

Functions

static nserror nsw32_sslcert_viewer_key (struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
 callback for keypress on ssl certificate window More...
 
static nserror nsw32_sslcert_viewer_mouse (struct nsw32_corewindow *nsw32_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action on ssl certificate window More...
 
static nserror nsw32_sslcert_viewer_draw (struct nsw32_corewindow *nsw32_cw, int scrollx, int scrolly, struct rect *r)
 callback on draw event for ssl certificate window More...
 
static nserror nsw32_sslcert_viewer_close (struct nsw32_corewindow *nsw32_cw)
 callback on close event for ssl certificate window More...
 
nserror nsw32_cert_verify (struct nsurl *url, const struct cert_chain *chain, nserror(*cb)(bool proceed, void *pw), void *cbpw)
 Prompt the user to verify a certificate with issuse. More...
 
static void nsw32_window_ssl_cert_size (HWND hwnd, struct nsw32_sslcert_window *certwin)
 position and size ssl cert window widgets. More...
 
static nserror nsw32_crtvrfy_destroy (struct nsw32_sslcert_window *crtwin)
 Destroy a certificate viewing window. More...
 
static LRESULT nsw32_window_ssl_cert_command (HWND hwnd, struct nsw32_sslcert_window *crtwin, int notification_code, int identifier, HWND ctrl_window)
 handle command message on ssl certificate viewing window. More...
 
static LRESULT CALLBACK nsw32_window_ssl_cert_event_callback (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 callback for SSL certificate window win32 events More...
 
nserror nsws_create_cert_verify_class (HINSTANCE hInstance)
 Create the ssl viewer window class. More...
 

Variables

static const char windowclassname_sslcert [] = "nswssslcertwindow"
 

Detailed Description

Implementation of win32 certificate viewing using nsw32 core windows.

Definition in file ssl_cert.c.

Macro Definition Documentation

◆ CMD_BTN_H

#define CMD_BTN_H   23

command button height

Definition at line 51 of file ssl_cert.c.

Referenced by nsw32_cert_verify(), and nsw32_window_ssl_cert_size().

◆ CMD_BTN_W

#define CMD_BTN_W   75

comand button width

Definition at line 49 of file ssl_cert.c.

Referenced by nsw32_cert_verify(), and nsw32_window_ssl_cert_size().

◆ DLG_MRGN

#define DLG_MRGN   11

dialog margin

Definition at line 45 of file ssl_cert.c.

Referenced by nsw32_cert_verify(), and nsw32_window_ssl_cert_size().

◆ WRN_ICO_H

#define WRN_ICO_H   32

warning icon height

Definition at line 47 of file ssl_cert.c.

Referenced by nsw32_cert_verify(), and nsw32_window_ssl_cert_size().

Function Documentation

◆ nsw32_cert_verify()

nserror nsw32_cert_verify ( struct nsurl url,
const struct cert_chain certs,
nserror(*)(bool proceed, void *pw)  cb,
void *  cbpw 
)

Prompt the user to verify a certificate with issuse.

Parameters
urlThe URL being verified.
certsThe certificate to be verified
numThe number of certificates to be verified.
cbCallback upon user decision.
cbpwContext pointer passed to cb
Returns
NSERROR_OK or error code if prompt creation failed.

Definition at line 172 of file ssl_cert.c.

References nsw32_corewindow::cb_table, nsw32_corewindow::close, CMD_BTN_H, CMD_BTN_W, nsw32_sslcert_window::core, DLG_MRGN, nsw32_corewindow::draw, hinst, nsw32_sslcert_window::hWnd, IDC_SSLCERT_BTN_ACCEPT, IDC_SSLCERT_BTN_REJECT, nsw32_corewindow::key, nsw32_corewindow::mouse, NSERROR_NOMEM, NSERROR_OK, NSLOG, nsw32_corewindow_init(), nsw32_sslcert_viewer_close(), nsw32_sslcert_viewer_draw(), nsw32_sslcert_viewer_key(), nsw32_sslcert_viewer_mouse(), ShowWindow, nsw32_sslcert_window::ssl_data, sslcert_viewer_create_session_data(), sslcert_viewer_init(), nsw32_corewindow::title, windowclassname_sslcert, and WRN_ICO_H.

Here is the call graph for this function:

◆ nsw32_crtvrfy_destroy()

static nserror nsw32_crtvrfy_destroy ( struct nsw32_sslcert_window crtwin)
static

Destroy a certificate viewing window.

Parameters
crtwinThe certificate viewer context
Returns
NSERROR_OK on success otherwise appropriate error code

Definition at line 345 of file ssl_cert.c.

References nsw32_sslcert_window::core, nsw32_sslcert_window::hWnd, NSERROR_OK, nsw32_corewindow_fini(), nsw32_sslcert_window::ssl_data, and sslcert_viewer_fini().

Referenced by nsw32_window_ssl_cert_command(), and nsw32_window_ssl_cert_event_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_sslcert_viewer_close()

static nserror nsw32_sslcert_viewer_close ( struct nsw32_corewindow nsw32_cw)
static

callback on close event for ssl certificate window

Parameters
nsw32_cwThe nsw32 core window structure.
Returns
NSERROR_OK on success otherwise appropriate error code

Definition at line 163 of file ssl_cert.c.

References nsw32_corewindow::hWnd, and NSERROR_OK.

Referenced by nsw32_cert_verify().

Here is the caller graph for this function:

◆ nsw32_sslcert_viewer_draw()

static nserror nsw32_sslcert_viewer_draw ( struct nsw32_corewindow nsw32_cw,
int  scrollx,
int  scrolly,
struct rect r 
)
static

callback on draw event for ssl certificate window

Parameters
nsw32_cwThe nsw32 core window structure.
scrollxThe horizontal scroll offset.
scrollyThe vertical scroll offset.
rThe rectangle of the window that needs updating.
Returns
NSERROR_OK on success otherwise appropriate error code

Definition at line 133 of file ssl_cert.c.

References redraw_context::interactive, NSERROR_OK, nsw32_sslcert_window::ssl_data, sslcert_viewer_redraw(), and win_plotters.

Referenced by nsw32_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_sslcert_viewer_key()

static nserror nsw32_sslcert_viewer_key ( struct nsw32_corewindow nsw32_cw,
uint32_t  nskey 
)
static

callback for keypress on ssl certificate window

Parameters
nsw32_cwThe nsw32 core window structure.
nskeyThe netsurf key code
Returns
NSERROR_OK on success otherwise appropriate error code

Definition at line 84 of file ssl_cert.c.

References NSERROR_NOT_IMPLEMENTED, NSERROR_OK, nsw32_sslcert_window::ssl_data, and sslcert_viewer_keypress().

Referenced by nsw32_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_sslcert_viewer_mouse()

static nserror nsw32_sslcert_viewer_mouse ( struct nsw32_corewindow nsw32_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse action on ssl certificate window

Parameters
nsw32_cwThe nsw32 core window structure.
mouse_statenetsurf mouse state on event
xlocation of event
ylocation of event
Returns
NSERROR_OK on success otherwise appropriate error code

Definition at line 108 of file ssl_cert.c.

References NSERROR_OK, nsw32_sslcert_window::ssl_data, and sslcert_viewer_mouse_action().

Referenced by nsw32_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_window_ssl_cert_command()

static LRESULT nsw32_window_ssl_cert_command ( HWND  hwnd,
struct nsw32_sslcert_window crtwin,
int  notification_code,
int  identifier,
HWND  ctrl_window 
)
static

handle command message on ssl certificate viewing window.

Parameters
hwndThe win32 window handle.
crtwincertificate window context.
notification_codenotifiction code
identifiernotification identifier
ctrl_windowThe win32 control window handle
Returns
appropriate response for command

Definition at line 370 of file ssl_cert.c.

References IDC_SSLCERT_BTN_ACCEPT, IDC_SSLCERT_BTN_REJECT, NSLOG, nsw32_crtvrfy_destroy(), nsw32_sslcert_window::ssl_data, sslcert_viewer_accept(), and sslcert_viewer_reject().

Referenced by nsw32_window_ssl_cert_event_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_window_ssl_cert_event_callback()

static LRESULT CALLBACK nsw32_window_ssl_cert_event_callback ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

callback for SSL certificate window win32 events

Parameters
hwndThe win32 window handle
msgThe win32 message identifier
wparamThe w win32 parameter
lparamThe l win32 parameter

Definition at line 409 of file ssl_cert.c.

References nsw32_crtvrfy_destroy(), nsw32_window_ssl_cert_command(), nsw32_window_ssl_cert_size(), nsw32_sslcert_window::ssl_data, and sslcert_viewer_reject().

Referenced by nsws_create_cert_verify_class().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_window_ssl_cert_size()

static void nsw32_window_ssl_cert_size ( HWND  hwnd,
struct nsw32_sslcert_window certwin 
)
static

position and size ssl cert window widgets.

Parameters
hwndThe win32 handle of the window
certwinThe certificate viewer context

Definition at line 304 of file ssl_cert.c.

References CMD_BTN_H, CMD_BTN_W, nsw32_sslcert_window::core, DLG_MRGN, nsw32_sslcert_window::hAccept, nsw32_sslcert_window::hReject, nsw32_sslcert_window::hTxt, nsw32_corewindow::hWnd, and WRN_ICO_H.

Referenced by nsw32_window_ssl_cert_event_callback().

Here is the caller graph for this function:

◆ nsws_create_cert_verify_class()

nserror nsws_create_cert_verify_class ( HINSTANCE  hinstance)

Create the ssl viewer window class.

Parameters
hinstanceThe application instance
Returns
NSERROR_OK on success or NSERROR_INIT_FAILED if the class creation failed.

Definition at line 444 of file ssl_cert.c.

References NSERROR_INIT_FAILED, NSERROR_OK, nsw32_window_ssl_cert_event_callback(), win_perror(), and windowclassname_sslcert.

Referenced by WinMain().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ windowclassname_sslcert

const char windowclassname_sslcert[] = "nswssslcertwindow"
static

Definition at line 53 of file ssl_cert.c.

Referenced by nsw32_cert_verify(), and nsws_create_cert_verify_class().