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_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_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 143.
This enum specifies formats of ssh key fingerprint.
Identifier | Description |
---|---|
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 113.
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 122.
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 61.
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 162.
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 52.
This function lookup the key algorithm name and calls the assh_key_load function.
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 92.
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 104.
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_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 129.
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 137.
This function saves one or more keys to a file.
See also asshh_key_save_file.