OpenVAS Libraries  6.0+beta5
Functions
nasl_cert.h File Reference

Protos and data structures for CERT functions used by NASL scripts. More...

Go to the source code of this file.

Functions

tree_cellnasl_cert_open (lex_ctxt *lexic)
 Create a certificate object. More...
 
tree_cellnasl_cert_close (lex_ctxt *lexic)
 Release a certificate object. More...
 
tree_cellnasl_cert_query (lex_ctxt *lexic)
 Query a certificate object. More...
 

Detailed Description

Protos and data structures for CERT functions used by NASL scripts.

This file contains the protos for nasl_cert.c

Function Documentation

tree_cell* nasl_cert_close ( lex_ctxt lexic)

Release a certificate object.

NASL Function: cert_close

Takes a cert identifier as returned by cert_open and releases the associated resources.

NASL Unnamed Parameters:
  • Object id of the certificate. 0 acts as a NOP.
NASL Returns:
none
Parameters
[in]lexicLexical context of the NASL interpreter.
Returns
none
tree_cell* nasl_cert_open ( lex_ctxt lexic)

Create a certificate object.

NASL Function: cert_open

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.

NASL Unnamed Parameters:
  • String/data object with the certificate. Either binary or PEM encoded.
NASL Named Parameters:
  • errorvar Name of a variable used on error to return an error description.
NASL Returns:
An integer used as an id for the certificate; on error 0 is returned.
Parameters
[in]lexicLexical context of the NASL interpreter.
Returns
On success the function returns a tree-cell with a non-zero object identifier for use with other cert functions; zero is returned on error.
tree_cell* nasl_cert_query ( lex_ctxt lexic)

Query a certificate object.

NASL Function: cert_query

Takes a cert identifier as first unnamed argument and a command string as second argument. That commonis used to select specific information from the certificate. For certain commandss 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:

  • serial The serial number of the certificate.
  • subject Returns the subject. To query the subjectAltName the named parameters idx can be used. If idx is used the return value is an array, with the first element giving the type of the altSubjectName and the second element the actual data. Types may be one: "xxx", "xxx", "xxx".
  • not-before The notBefore time as UTC value in ISO time format (e.g. "20120930T143521").
  • not-after The notAfter time as UTC value in ISO time format (e.g. "20280929T143520").
  • all Return all available information in a human readable format. Not yet implemented.
  • hostnames Return an array with all hostnames listed in the certificates, i.e. the CN part of the subject and all dns-name type subjectAltNames.
NASL Unnamed Parameters:
  • Object id of the certificate.
  • A string with the command to select what to return; see above.
NASL Named Parameters:
  • idx Used by certain commands to select the n-th value of a set of values. If not given 0 is assumed.
NASL Returns:
A NASL type depending on the used command. NULL is returned on error.
Parameters
[in]lexicLexical context of the NASL interpreter.
Returns
none