|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
RSA-2048 PKCS#1 v1.5 signature primitive (RFC 8017) - verify + software sign. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | PC_RSA_KEY_BYTES 256 |
| RSA modulus / signature size in bytes (RSA-2048). | |
| #define | PC_RSA_SIG_BYTES 256 |
| PKCS#1 v1.5 signature size for RSA-2048 in bytes. | |
| #define | PC_PKCS1_DIGESTINFO_LEN 19 |
| Length of the DER DigestInfo wrapper for SHA-256 (RFC 8017 / RFC 5754). | |
| #define | PC_PKCS1_SHA512_DIGESTINFO_LEN 19 |
| Length of the DER DigestInfo wrapper for SHA-512. | |
Enumerations | |
| enum class | pc_rsa_hash : uint8_t { SHA256 = 0 , SHA512 = 1 } |
| Hash algorithm selecting the RSA signature scheme (RFC 8017 §9.2). More... | |
Functions | |
| int | pc_rsa_verify (const uint8_t n_be[PC_RSA_KEY_BYTES], const uint8_t e_be4[4], const uint8_t *msg, size_t msg_len, const uint8_t *sig, size_t sig_len, pc_rsa_hash hash) |
Verify an RSA-2048 PKCS#1 v1.5 signature over msg. | |
Variables | |
| const uint8_t | pc_pkcs1_sha256_digestinfo [PC_PKCS1_DIGESTINFO_LEN] |
| The DER-encoded DigestInfo wrapper for SHA-256 (prepend to the 32-byte digest). | |
| const uint8_t | pc_pkcs1_sha512_digestinfo [PC_PKCS1_SHA512_DIGESTINFO_LEN] |
| The DER-encoded DigestInfo wrapper for SHA-512 (prepend to the 64-byte digest). | |
RSA-2048 PKCS#1 v1.5 signature primitive (RFC 8017) - verify + software sign.
The shared, protocol-agnostic RSA primitive: it takes raw big-endian key material (modulus n, exponent) and a message, and does the RSASSA-PKCS1-v1.5 math with a SHA-256 or SHA-512 digest. It knows nothing about SSH key blobs, host-key storage, or the "ssh-rsa" / "rsa-sha2-256" wire names - that layer lives in network_drivers/presentation/ssh/crypto/ssh_rsa and calls into this primitive.
Verify runs on both platforms (mbedtls on Arduino/ESP32, software on native). The software sign (pc_rsa_sign_sw, raw n/d) is the native-only reference path used by the tests; on-device signing with a cached host-key context is the SSH layer's job.
Definition in file rsa.h.
| #define PC_RSA_KEY_BYTES 256 |
| #define PC_RSA_SIG_BYTES 256 |
| #define PC_PKCS1_DIGESTINFO_LEN 19 |
| #define PC_PKCS1_SHA512_DIGESTINFO_LEN 19 |
|
strong |
| int pc_rsa_verify | ( | const uint8_t | n_be[PC_RSA_KEY_BYTES], |
| const uint8_t | e_be4[4], | ||
| const uint8_t * | msg, | ||
| size_t | msg_len, | ||
| const uint8_t * | sig, | ||
| size_t | sig_len, | ||
| pc_rsa_hash | hash | ||
| ) |
Verify an RSA-2048 PKCS#1 v1.5 signature over msg.
| n_be | Modulus n, 256 bytes big-endian. |
| e_be4 | Public exponent e, 4 bytes big-endian (typically 65537). |
| msg | Message that was signed (this hashes it; do not pre-hash). |
| msg_len | Message length. |
| sig | Signature, big-endian. |
| sig_len | Signature length (must equal PC_RSA_KEY_BYTES). |
| hash | Digest algorithm (SHA-256 / SHA-512). |
Definition at line 55 of file rsa.cpp.
References PC_RSA_KEY_BYTES, pc_sha256(), PC_SHA256_DIGEST_LEN, pc_sha512(), PC_SHA512_DIGEST_LEN, and SHA512.
|
extern |
|
extern |