OpenVAS Libraries
6.0+beta5
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include "system.h"
#include "certificate.h"
#include "nasl_signature.h"
#include "nasl_tree.h"
#include "nasl_var.h"
#include "nasl_func.h"
#include "nasl_lex_ctxt.h"
#include "nasl_debug.h"
Functions | |
int | nasl_verify_signature (const char *filename) |
char * | nasl_extract_signature_fprs (const char *filename) |
Extracts fingerprints of signing public keys in a given signature file. More... | |
char * | nasl_get_pubkey (gpgme_ctx_t ctx, char *fingerprint) |
Reads in a full public key. The returned string will be ascii- armored. More... | |
GSList * | nasl_get_all_certificates () |
Creates certificate_ts for all certificates found in the. More... | |
char* nasl_extract_signature_fprs | ( | const char * | filename | ) |
Extracts fingerprints of signing public keys in a given signature file.
Works like nasl_verify_signature, but always returns a string with the fingerprints in it (NULL if error), even if the keys are not trusted.
filename | Path to the signed file (e.g. /../check_killerapp.nasl). |
GSList* nasl_get_all_certificates | ( | ) |
Creates certificate_ts for all certificates found in the.
(custom) gpg home directory and returns a pointer to a GSList containing (pointers to) them.
Creation has to be done in two steps: First retrieve info like ownername and trust level and then read in the full public key. The two steps have to be done seperately because the two gpgme listing operations are exclusive.
char* nasl_get_pubkey | ( | gpgme_ctx_t | ctx, |
char * | fingerprint | ||
) |
Reads in a full public key. The returned string will be ascii- armored.
ctx | The gpgme context to work in. |
fingerprint | Fingerprint of the key to return. |
int nasl_verify_signature | ( | const char * | filename | ) |
Checks the detached OpenPGP signature of the file given by FILENAME. The name of the signature file is derived from FILENAME by appending ".asc".
If a signature file exists and it contains only fully valid signatures, the function returns 0. If any of the signatures is not valid or was made by an unknown or untrusted key, the function returns 1. If an error occurs or the file does not have a corresponding detached signature the function returns -1.
filename | Filename (e.g. 1.txt) for which to check signature (e.g. 1.txt.asc). |