OpenVAS Libraries  4.0+rc3.SVN
Functions
base/certificate.c File Reference

Facilities for certificates and certificate collections. More...

#include "certificate.h"

Functions

certificate_tcertificate_create ()
 Create a new, empty certificate structure.
certificate_tcertificate_create_full (const char *fingerprint, const char *owner, const char *public_key, gboolean trusted)
 Create a new certificate structure wih all values set.
void certificate_free (certificate_t *certificate)
 Free memory of a certificate structure.
const gchar * certificate_fingerprint (const certificate_t *certificate)
 Get the fingerprint of a certificate.
const gchar * certificate_owner (const certificate_t *certificate)
 Get the owner of a certificate.
const gchar * certificate_public_key (const certificate_t *certificate)
 Get the public key of a certificate.
gboolean certificate_trusted (const certificate_t *certificate)
 Get the trustedness of a certificate.
int certificate_set_fingerprint (certificate_t *certificate, const gchar *fingerprint)
 Set the fingerprint of a certificate.
int certificate_set_owner (certificate_t *certificate, const gchar *owner)
 Set the owner of a certificate.
int certificate_set_public_key (certificate_t *certificate, const gchar *public_key)
 Set the public key of a certificate.
void certificate_set_trusted (certificate_t *certificate, gboolean trusted)
 Set the trustedness of a certificate.
certificates_tcertificates_create ()
 Make a collection of certificates.
void certificates_free (certificates_t *certificates)
 Free a collection of certificates.
guint certificates_size (certificates_t *certificates)
 Get the size of a collection of certificates.
void certificates_add (certificates_t *certificates, certificate_t *certificate)
 Add a certificate to a collection of certificate.
certificate_tcertificates_find (certificates_t *certificates, gconstpointer data, GCompareFunc function)
 Search the certificates with a function.

Detailed Description

Facilities for certificates and certificate collections.

This file provides facilities for data about certificates, and collections of such data. This includes two types, certificate_t and certificates_t, and functions for manipulating structures of these types.


Function Documentation

certificate_t* certificate_create ( void  )

Create a new, empty certificate structure.

Todo:
Correct doc or implementation for the set_* methods, they always return 0.
Returns:
NULL in case the memory could not be allocated. Else an empty certificate structure which needs to be released using certificate_free .
certificate_t* certificate_create_full ( const char *  fingerprint,
const char *  owner,
const char *  public_key,
gboolean  trusted 
)

Create a new certificate structure wih all values set.

Parameters:
fingerprintFingerprint of the certificate.
ownerName of the owner of the certificate.
public_keyFull public key of the certificate.
trustedWhether or not this certificate is trustworthy.
Returns:
NULL in case the memory could not be allocated. Else a filled certificate structure which owns its values and needs to be released using certificate_free .
const gchar* certificate_fingerprint ( const certificate_t certificate)

Get the fingerprint of a certificate.

Parameters:
certificateThe certificate.
Returns:
The fingerprint, which may be NULL.
void certificate_free ( certificate_t certificate)

Free memory of a certificate structure.

Parameters:
nThe structure to be freed.
const gchar* certificate_owner ( const certificate_t certificate)

Get the owner of a certificate.

Parameters:
certificateThe certificate.
Returns:
The owner, which may be NULL.
const gchar* certificate_public_key ( const certificate_t certificate)

Get the public key of a certificate.

Parameters:
certificateThe certificate.
Returns:
The public key, which may be NULL.
int certificate_set_fingerprint ( certificate_t certificate,
const gchar *  fingerprint 
)

Set the fingerprint of a certificate.

Parameters:
certificateThe certificate.
fingerprintThe fingerprint.
Returns:
0 on success, -1 on error.
int certificate_set_owner ( certificate_t certificate,
const gchar *  owner 
)

Set the owner of a certificate.

Parameters:
certificateThe certificate.
ownerThe owner.
Returns:
0 on success, -1 on error.
int certificate_set_public_key ( certificate_t certificate,
const gchar *  public_key 
)

Set the public key of a certificate.

Parameters:
certificateThe certificate.
publickey The public key.
Returns:
0 on success, -1 on error.
void certificate_set_trusted ( certificate_t certificate,
gboolean  trusted 
)

Set the trustedness of a certificate.

Parameters:
certificateThe certificate.
trustedTRUE if trusted, else FALSE.
gboolean certificate_trusted ( const certificate_t certificate)

Get the trustedness of a certificate.

Parameters:
certificateThe certificate.
Returns:
TRUE if the key is trusted, else FALSE.
void certificates_add ( certificates_t certificates,
certificate_t certificate 
)

Add a certificate to a collection of certificate.

Parameters:
certificatesThe collection of certificates.
certificates_t* certificates_create ( )

Make a collection of certificates.

Returns:
A new collection of certificates or NULL on error.
certificate_t* certificates_find ( certificates_t certificates,
gconstpointer  data,
GCompareFunc  function 
)

Search the certificates with a function.

Parameters:
certificatesCertificates to search.
dataFirst argument to function.
functionComparison function.
Returns:
The first element for which the comparison function function returns 0.
void certificates_free ( certificates_t certificates)

Free a collection of certificates.

Parameters:
certificatesThe collection of certificates.
guint certificates_size ( certificates_t certificates)

Get the size of a collection of certificates.

Returns:
The number of entries in the collection.