assh/helper_key.h header reference

Description [link] 

This header file provides helper functions designed to load and store SSH keys on disk.

See also Key types and formats and assh/assh_key.h.

Members [link] 

Type [link] 

Functions [link] 

  • assh_status_t asshh_hostkey_load_file(struct assh_context_s *c, const char *key_algo, enum assh_algo_class_e role, FILE *file, enum assh_key_format_e format, size_t size_hint)
  • assh_status_t asshh_hostkey_load_filename(struct assh_context_s *c, const char *key_algo, enum assh_algo_class_e role, const char *filename, enum assh_key_format_e format, size_t size_hint)
  • assh_status_t asshh_key_create(struct assh_context_s *c, struct assh_key_s **key, size_t bits, const char *key_algo, enum assh_algo_class_e role)
  • assh_status_t asshh_key_fingerprint(struct assh_context_s *c, const struct assh_key_s *key, enum asshh_fingerprint_fmt_e fmt, char *buf, size_t *buf_size, const char **fmt_name)
  • assh_status_t asshh_key_load(struct assh_context_s *c, struct assh_key_s **key, const char *key_algo, enum assh_algo_class_e role, enum assh_key_format_e format, const uint8_t **blob, size_t blob_len)
  • assh_status_t asshh_key_load_base64(struct assh_context_s *c, struct assh_key_s **key, const char *key_algo, enum assh_algo_class_e role, enum assh_key_format_e format, const char *b64, size_t b64_len)
  • assh_status_t asshh_key_load_file(struct assh_context_s *c, struct assh_key_s **head, const char *key_algo, enum assh_algo_class_e role, FILE *file, enum assh_key_format_e format, const char *passphrase, size_t size_hint)
  • assh_status_t asshh_key_load_filename(struct assh_context_s *c, struct assh_key_s **head, const char *key_algo, enum assh_algo_class_e role, const char *filename, enum assh_key_format_e format, const char *passphrase, size_t size_hint)
  • assh_status_t asshh_key_output_base64(struct assh_context_s *c, const struct assh_key_s *key, enum assh_key_format_e format, char *b64, size_t *b64_len)
  • assh_status_t asshh_key_save_file(struct assh_context_s *c, const struct assh_key_s *head, FILE *file, enum assh_key_format_e format, const char *passphrase)
  • assh_status_t asshh_key_save_filename(struct assh_context_s *c, const struct assh_key_s *head, const char *filename, enum assh_key_format_e format, const char *passphrase)

Members detail [link] 

enum asshh_fingerprint_fmt_e [link] 

This enum is declared in assh/helper_key.h source file, line 173.

This enum specifies formats of ssh key fingerprint.

IdentifierDescription
ASSH_FP_RFC4716_MD5
ASSH_FP_RFC4255_SHA1
ASSH_FP_RFC6594_SHA256
ASSH_FP_BASE64_SHA256

assh_status_t asshh_hostkey_load_file(struct assh_context_s *c, const char *key_algo, enum assh_algo_class_e role, FILE *file, enum assh_key_format_e format, size_t size_hint) [link] 

This function is declared in assh/helper_key.h source file, line 143.

This function loads a key from a file handler and register the key on the library context.

See also asshh_key_load_file.

assh_status_t asshh_hostkey_load_filename(struct assh_context_s *c, const char *key_algo, enum assh_algo_class_e role, const char *filename, enum assh_key_format_e format, size_t size_hint) [link] 

This function is declared in assh/helper_key.h source file, line 152.

This function loads a key from a file name and register the key on the library context.

See also asshh_key_load_filename.

assh_status_t asshh_key_create(struct assh_context_s *c, struct assh_key_s **key, size_t bits, const char *key_algo, enum assh_algo_class_e role) [link] 

This function is declared in assh/helper_key.h source file, line 91.

Preprocessor condition: defined( CONFIG_ASSH_KEY_CREATE )

This function lookup the key algorithm name and calls the assh_key_create function.

assh_status_t asshh_key_fingerprint(struct assh_context_s *c, const struct assh_key_s *key, enum asshh_fingerprint_fmt_e fmt, char *buf, size_t *buf_size, const char **fmt_name) [link] 

This function is declared in assh/helper_key.h source file, line 192.

This function writes a fingerprint string of a key in the provided buffer. The value of buf_size is updated with the required size when a NULL buffer is passed. The string is null terminated.

The function returns ASSH_NO_DATA when the format is not known. All supported format ids are contiguous, starting at 0.

assh_status_t asshh_key_load(struct assh_context_s *c, struct assh_key_s **key, const char *key_algo, enum assh_algo_class_e role, enum assh_key_format_e format, const uint8_t **blob, size_t blob_len) [link] 

This function is declared in assh/helper_key.h source file, line 54.

This function lookup the key algorithm name and calls the assh_key_load function. This function does not support Container formats.

assh_status_t asshh_key_load_base64(struct assh_context_s *c, struct assh_key_s **key, const char *key_algo, enum assh_algo_class_e role, enum assh_key_format_e format, const char *b64, size_t b64_len) [link] 

This function is declared in assh/helper_key.h source file, line 65.

This function extracts the base64 encoded blob and try to load the embedded binary key by calling the assh_key_load function. This function does not support Container formats.

assh_status_t asshh_key_load_file(struct assh_context_s *c, struct assh_key_s **head, const char *key_algo, enum assh_algo_class_e role, FILE *file, enum assh_key_format_e format, const char *passphrase, size_t size_hint) [link] 

This function is declared in assh/helper_key.h source file, line 122.

This function loads a key from a file handle and inserts the key in the head linked list. Both binary and text key formats are supported. This function relies on assh_key_load to load the binary key blob.

Depending on the format, the function may be able to guess the type of key when NULL is passed as algo parameter. When the type of key is not supported by a registered algorithm, the function fails but the position of the file handle is advanced.

When the ASSH_KEY_FMT_NONE format is specified, multiple supported formats are tried.

When a binary format is used, the size_hint argument specifies the amount of bytes that must be read from the file. When a text format is used, the size_hint argument only controls the allocation of the temporary buffer used to store the underlying binary format. In either cases, a large enough default value is used when 0 is passed.

assh_status_t asshh_key_load_filename(struct assh_context_s *c, struct assh_key_s **head, const char *key_algo, enum assh_algo_class_e role, const char *filename, enum assh_key_format_e format, const char *passphrase, size_t size_hint) [link] 

This function is declared in assh/helper_key.h source file, line 134.

This function loads a key from a file name and inserts the key in a linked list. This function relies on asshh_key_load_file.

assh_status_t asshh_key_output_base64(struct assh_context_s *c, const struct assh_key_s *key, enum assh_key_format_e format, char *b64, size_t *b64_len) [link] 

This function is declared in assh/helper_key.h source file, line 82.

This function call the assh_key_output function to serialize the key then encode the resulting blob in base64 format.

If the b64 parameter is NULL, the function updates the b64_len parmeter with a size value which is equal or slightly greater to what is needed to actually store the encoded key. In the other case, the size of the available buffer must be passed and the function updates it with the actual number of characters written.

This function does not support Container formats.

assh_status_t asshh_key_save_file(struct assh_context_s *c, const struct assh_key_s *head, FILE *file, enum assh_key_format_e format, const char *passphrase) [link] 

This function is declared in assh/helper_key.h source file, line 159.

This function saves one or more keys to a file.

See also asshh_key_load_filename.

assh_status_t asshh_key_save_filename(struct assh_context_s *c, const struct assh_key_s *head, const char *filename, enum assh_key_format_e format, const char *passphrase) [link] 

This function is declared in assh/helper_key.h source file, line 167.

This function saves one or more keys to a file.

See also asshh_key_save_file.

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Feb 5 23:59:15 2023 using MkDoc