Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
SSH keygen API

Enumerations

enum  ssh_host_key_type { SSH_HOST_KEY_TYPE_RSA }
 Types of host keys that can be generated. More...
enum  ssh_host_key_format { SSH_HOST_KEY_FORMAT_DER , SSH_HOST_KEY_FORMAT_PEM }
 Formats that SSH host keys can be exported/imported in. More...

Functions

int ssh_keygen (int key_index, enum ssh_host_key_type key_type, size_t key_size_bits)
 Generate a new SSH host key.
int ssh_keygen_export (int key_index, bool private_key, enum ssh_host_key_format fmt, void *buf, size_t buf_len)
 Export a generated SSH host key.
int ssh_keygen_import (int key_index, bool private_key, enum ssh_host_key_format fmt, const void *buf, size_t buf_len)
 Import an SSH host key.
int ssh_keygen_free (int key_index)
 Free a generated SSH host key.

Detailed Description

Since
4.5
Version
0.1.0

Enumeration Type Documentation

◆ ssh_host_key_format

#include <zephyr/net/ssh/keygen.h>

Formats that SSH host keys can be exported/imported in.

Enumerator
SSH_HOST_KEY_FORMAT_DER 

DER format.

SSH_HOST_KEY_FORMAT_PEM 

PEM format.

◆ ssh_host_key_type

#include <zephyr/net/ssh/keygen.h>

Types of host keys that can be generated.

Enumerator
SSH_HOST_KEY_TYPE_RSA 

RSA host key type.

Function Documentation

◆ ssh_keygen()

int ssh_keygen ( int key_index,
enum ssh_host_key_type key_type,
size_t key_size_bits )

#include <zephyr/net/ssh/keygen.h>

Generate a new SSH host key.

Parameters
key_indexIndex of the key to generate. Must be between 0 and CONFIG_SSH_MAX_HOST_KEYS - 1
key_typeType of key to generate
key_size_bitsSize of the key to generate, in bits. For RSA keys, this must be at least 2048
Returns
0 on success, negative error code on failure

◆ ssh_keygen_export()

int ssh_keygen_export ( int key_index,
bool private_key,
enum ssh_host_key_format fmt,
void * buf,
size_t buf_len )

#include <zephyr/net/ssh/keygen.h>

Export a generated SSH host key.

Parameters
key_indexIndex of the key to export. Must be between 0 and CONFIG_SSH_MAX_HOST_KEYS - 1
private_keyWhether to export the private key (true) or public key (false)
fmtFormat to export the key in
bufBuffer to write the exported key to
buf_lenLength of the buffer, in bytes
Returns
On success, the number of bytes written to the buffer. On failure, a negative error code

◆ ssh_keygen_free()

int ssh_keygen_free ( int key_index)

#include <zephyr/net/ssh/keygen.h>

Free a generated SSH host key.

Parameters
key_indexIndex of the key to free. Must be between 0 and CONFIG_SSH_MAX_HOST_KEYS - 1
Returns
0 on success, negative error code on failure

◆ ssh_keygen_import()

int ssh_keygen_import ( int key_index,
bool private_key,
enum ssh_host_key_format fmt,
const void * buf,
size_t buf_len )

#include <zephyr/net/ssh/keygen.h>

Import an SSH host key.

Parameters
key_indexIndex of the key to import. Must be between 0 and CONFIG_SSH_MAX_HOST_KEYS - 1
private_keyWhether the key being imported is a private key (true) or a public key (false)
fmtFormat the key is in
bufBuffer containing the key to import
buf_lenLength of the buffer, in bytes
Returns
0 on success, negative error code on failure