OpenVAS Libraries  4.0+rc3.SVN
Macros | Functions
openvas_certificate_file.c File Reference
#include <fcntl.h>
#include <unistd.h>
#include "certificate.h"
#include "openvas_certificate_file.h"

Macros

#define KEY_CERT_OWNERNAME   "ownername"
#define KEY_CERT_TRUSTED   "trusted"
#define _(abc)   abc

Functions

gboolean openvas_certificate_file_write (GHashTable *certs, char *filename)
 Writes all certificates found in certs.
GHashTable * openvas_certificate_file_read (char *filename)
 Reads all certificates found in file filename, creates.

Detailed Description

Todo:
Re-enable error reporting (currently commented, show_error)

Functions to "(de)serialize" one or more certificates to or from a file. The public key will neither be stored nor loaded. Makes use of GLibs GKeyFile mechanism. The files will and have to look like:

  [C3B468D2288C68B9D526452248479FF648DB4530]
  ownername= Transfer Integrity
  trusted=false
  

where there can be more than one entry as shown above. This follows a freeddesktop.org specification and is parsed using GLibs GKeyFile.


Macro Definition Documentation

#define _ (   abc)    abc
Todo:
Resolve workaround, real i18n
#define KEY_CERT_OWNERNAME   "ownername"

Key used to store ownernames.

#define KEY_CERT_TRUSTED   "trusted"

Key used to store trust level.


Function Documentation

GHashTable* openvas_certificate_file_read ( char *  filename)

Reads all certificates found in file filename, creates.

certificate_t structs, stores these in a GHashTable (with fingerprints as keys) and returns the hashtable.

Certificates can be written to that file calling openvas_certificate_file_write.

Parameters:
filenamePath to file to read certificates from.
Returns:
GHashTable with fingerprint/certificate_t* as key/values or NULL in case of an error.
See also:
openvas_certificate_file_write
gboolean openvas_certificate_file_write ( GHashTable *  certs,
char *  filename 
)

Writes all certificates found in certs.

(might be NULL) to the file filename.

Certificates can be retrieved from that file calling openvas_certificate_file_read.

Parameters:
contextContext of which the certificates shall be stored.
filenameFilename used to save the certificates.
Returns:
TRUE when successfull, FALSE otherwise.
See also:
openvas_certificate_file_read