Greenbone Vulnerability Management Libraries: util/sshutils.c File Reference

Greenbone Vulnerability Management Libraries 23.1.2

Macros | Functions
sshutils.c File Reference

Implementation of SSH related API. More...

`#include "sshutils.h"`
`#include <glib.h>`
`#include <gnutls/gnutls.h>`
`#include <gnutls/x509.h>`
`#include <libssh/libssh.h>`
`#include <string.h>`

Go to the source code of this file.

## Macros
#define | G_LOG_DOMAIN "libgvm util"
| GLib logging domain.

## Functions
char * | gvm_ssh_pkcs8_decrypt (const char *pkcs8_key, const char *passphrase)
| Decrypts a base64 encrypted ssh private key.
char * | gvm_ssh_public_from_private (const char *private_key, const char *passphrase)
| Exports a base64 encoded public key from a private key and its passphrase.
int | gvm_ssh_private_key_info (const char *private_key, const char *passphrase, const char **type, char **sha256_hash)
| Gets information from a SSH private key.

## Detailed Description

Implementation of SSH related API.

## Macro Definition Documentation

## ◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN "libgvm util"

GLib logging domain.

## Function Documentation

## ◆ gvm_ssh_pkcs8_decrypt()

char * gvm_ssh_pkcs8_decrypt | ( | const char * | pkcs8_key,
|  | const char * | passphrase )

Decrypts a base64 encrypted ssh private key.

Parameters

  [in] | pkcs8_key | PKCS#8 encrypted private key.
  [in] | passphrase | Passphrase for the private key.

Returns
  Decrypted private key if success, NULL otherwise.

## ◆ gvm_ssh_private_key_info()

int gvm_ssh_private_key_info | ( | const char * | private_key,
|  | const char * | passphrase,
|  | const char ** | type,
|  | char ** | sha256_hash )

Gets information from a SSH private key.

Parameters

  [in] | private_key | Private key to get info from.
  [in] | passphrase | Passphrase for the private key.
  [out] | type | Static string describing the type of the key.
  [out] | sha256_hash | The SHA-256 hash of the key.

Returns
  0 on success, -1 on error.

## ◆ gvm_ssh_public_from_private()

char * gvm_ssh_public_from_private | ( | const char * | private_key,
|  | const char * | passphrase )

Exports a base64 encoded public key from a private key and its passphrase.

Parameters

  [in] | private_key | Private key to export.
  [in] | passphrase | Passphrase for the private key.

Returns
  Allocated base64 encoded public key if success, NULL otherwise.