OpenVAS Libraries
9.0.3
|
Implementation of an API for X.509 certificates. More...
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <ksba.h>
#include <gcrypt.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "../misc/openvas_logging.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "nasl_debug.h"
#include "nasl_cert.h"
Go to the source code of this file.
Data Structures | |
struct | object_desc_s |
Macros | |
#define | DIM(v) (sizeof(v)/sizeof((v)[0])) |
#define | DIMof(type, member) DIM(((type *)0)->member) |
#define | spacep(p) (*(p) == ' ' || *(p) == '\t') |
#define | digitp(p) (*(p) >= '0' && *(p) <= '9') |
#define | hexdigitp(a) |
#define | atoi_1(p) (*(p) - '0' ) |
#define | atoi_2(p) ((atoi_1(p) * 10) + atoi_1((p)+1)) |
#define | atoi_4(p) ((atoi_2(p) * 100) + atoi_2((p)+2)) |
#define | xtoi_1(p) |
#define | xtoi_2(p) |
#define | tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) |
Typedefs | |
typedef struct object_desc_s * | object_desc_t |
Functions | |
tree_cell * | nasl_cert_open (lex_ctxt *lexic) |
Create a certificate object. More... | |
tree_cell * | nasl_cert_close (lex_ctxt *lexic) |
Release a certificate object. More... | |
tree_cell * | nasl_cert_query (lex_ctxt *lexic) |
Query a certificate object. More... | |
Implementation of an API for X.509 certificates.
This file contains the implementation of the cert_* NASL builtin functions.
Definition in file nasl_cert.c.
#define atoi_1 | ( | p | ) | (*(p) - '0' ) |
Definition at line 72 of file nasl_cert.c.
Definition at line 73 of file nasl_cert.c.
Definition at line 74 of file nasl_cert.c.
#define digitp | ( | p | ) | (*(p) >= '0' && *(p) <= '9') |
Definition at line 66 of file nasl_cert.c.
#define DIM | ( | v | ) | (sizeof(v)/sizeof((v)[0])) |
Definition at line 60 of file nasl_cert.c.
#define DIMof | ( | type, | |
member | |||
) | DIM(((type *)0)->member) |
Definition at line 61 of file nasl_cert.c.
#define hexdigitp | ( | a | ) |
Definition at line 67 of file nasl_cert.c.
#define spacep | ( | p | ) | (*(p) == ' ' || *(p) == '\t') |
Definition at line 65 of file nasl_cert.c.
#define tohex | ( | n | ) | ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) |
Definition at line 81 of file nasl_cert.c.
#define xtoi_1 | ( | p | ) |
Definition at line 75 of file nasl_cert.c.
#define xtoi_2 | ( | p | ) |
Definition at line 77 of file nasl_cert.c.
typedef struct object_desc_s* object_desc_t |
Definition at line 99 of file nasl_cert.c.
Release a certificate object.
Takes a cert identifier as returned by cert_open and releases the associated resources.
[in] | lexic | Lexical context of the NASL interpreter. |
Definition at line 264 of file nasl_cert.c.
References FAKE_CELL, get_int_var_by_num(), and log_legacy_write().
Create a certificate object.
Takes a string/data as unnamed argument and returns an identifier used with the other cert functions. The data is usually the BER encoded certificate but the function will also try a PEM encoding on failure to parse BER encoded one.
[in] | lexic | Lexical context of the NASL interpreter. |
Definition at line 176 of file nasl_cert.c.
References err, get_str_var_by_num(), get_var_size_by_num(), log_legacy_write(), and object_desc_s::object_id.
Query a certificate object.
Takes a cert identifier as first unnamed argument and a command string as second argument. That command is used to select specific information from the certificate. For certain commands the named argument idx is used as well. Depending on this command the return value may be a number, a string, or an array of strings. Supported commands are:
[in] | lexic | Lexical context of the NASL interpreter. |
Definition at line 765 of file nasl_cert.c.
References get_int_var_by_num(), and log_legacy_write().