22#ifndef DETERMINISTICESPASYNCWEBSERVER_SSH_AUTH_H
23#define DETERMINISTICESPASYNCWEBSERVER_SSH_AUTH_H
64typedef bool (*
SshPubkeyCb)(
const char *user,
const uint8_t *blob,
size_t blob_len);
98int ssh_auth_handle_request(uint8_t i,
const uint8_t *payload,
size_t len, uint8_t *out,
size_t *out_len,
size_t cap);
User-facing configuration for DeterministicESPAsyncWebServer.
#define SSH_AUTH_PASS_MAX
Max stored password length.
#define SSH_AUTH_USER_MAX
Max stored user name (RFC 4252 imposes no limit; we cap for BSS).
void ssh_auth_set_pubkey_cb(SshPubkeyCb cb)
Install the publickey-authorization callback (nullptr → all fail).
int ssh_auth_build_success(uint8_t *out, size_t *out_len, size_t cap)
Build SSH_MSG_USERAUTH_SUCCESS.
void ssh_auth_set_password_cb(SshPasswordCb cb)
Install the password-verification callback (nullptr → all fail).
int ssh_auth_handle_request(uint8_t i, const uint8_t *payload, size_t len, uint8_t *out, size_t *out_len, size_t cap)
Handle a USERAUTH_REQUEST end-to-end for slot i.
int ssh_auth_build_failure(uint8_t *out, size_t *out_len, size_t cap, bool partial)
Build SSH_MSG_USERAUTH_FAILURE advertising "password".
bool(* SshPasswordCb)(const char *user, const char *password)
Application callback that validates a username/password pair.
int ssh_auth_parse_request(const uint8_t *payload, size_t len, SshAuthReq *req)
Parse an SSH_MSG_USERAUTH_REQUEST into req.
int ssh_auth_handle_service_request(const uint8_t *payload, size_t len, uint8_t *out, size_t *out_len, size_t cap)
Handle SSH_MSG_SERVICE_REQUEST; emit SERVICE_ACCEPT for ssh-userauth.
bool(* SshPubkeyCb)(const char *user, const uint8_t *blob, size_t blob_len)
Application callback that decides whether a public key is authorized for user. blob is the "ssh-rsa" ...
Parsed SSH_MSG_USERAUTH_REQUEST.
const uint8_t * signature
Raw signature bytes (points into the payload).
bool is_pubkey
True if a publickey method-request was parsed.
char pk_algo[20]
Public-key algorithm name.
bool is_password
True if a password method-request was parsed.
char method[16]
Method name ("none", "password", "publickey").
char password[SSH_AUTH_PASS_MAX]
Password (method == "password").
char user[SSH_AUTH_USER_MAX]
User name, null-terminated.
uint32_t pk_blob_len
Length of pk_blob.
char service[32]
Requested service ("ssh-connection").
size_t signed_prefix_len
Length of signed_prefix (payload up to the signature).
const uint8_t * pk_blob
Public-key blob (points into the payload).
const uint8_t * signed_prefix
Bytes of the request that the signature covers.
uint32_t signature_len
Length of signature.
bool has_signature
True if the request carried a signature.