30#ifndef PROTOCORE_SSH_RSA_H
31#define PROTOCORE_SSH_RSA_H
38#define SSH_RSA_KEY_DER_MAX 1700
48#define SSH_RSA_PUBKEY_ALG "ssh-rsa"
51#define SSH_RSA_PUBKEY_ALG_LEN 7
54static constexpr char SSH_RSA_SIG_ALG_SHA256[] =
"rsa-sha2-256";
57static constexpr char SSH_RSA_SIG_ALG_SHA512[] =
"rsa-sha2-512";
77#define SSH_RSA_PUBKEY_BLOB_MAX (4 + 7 + 4 + 1 + 4 + 4 + 1 + 256)
RSA-2048 PKCS#1 v1.5 signature primitive (RFC 8017) - verify + software sign.
pc_rsa_hash
Hash algorithm selecting the RSA signature scheme (RFC 8017 §9.2).
#define PC_RSA_SIG_BYTES
PKCS#1 v1.5 signature size for RSA-2048 in bytes.
#define PC_RSA_KEY_BYTES
RSA modulus / signature size in bytes (RSA-2048).
int pc_ssh_rsa_load_pubkey(void)
Load the public portion of the RSA host key into ssh_host_pubkey.
SshRsaPubKey ssh_host_pubkey
Static host public key (BSS). Set by pc_ssh_rsa_load_pubkey().
int ssh_rsa_sign(const uint8_t *msg, size_t msg_len, pc_rsa_hash hash, uint8_t sig[PC_RSA_SIG_BYTES])
Sign msg with the RSA host key (PKCS#1 v1.5, rsa-sha2-256/512).
int ssh_rsa_encode_pubkey(uint8_t *out, size_t *out_len, size_t out_cap)
Encode ssh_host_pubkey as the RFC 4253 §6.6 "ssh-rsa" public-key blob.
RSA-2048 public host key parameters. Allocated in BSS; contains only n and e.
uint8_t n[PC_RSA_KEY_BYTES]
Modulus n (256 bytes, big-endian).
bool loaded
True after pc_ssh_rsa_load_pubkey() succeeds.
uint8_t e_bytes[4]
Public exponent e (big-endian uint32).