21#ifndef PROTOCORE_RSA_H
22#define PROTOCORE_RSA_H
28#define PC_RSA_KEY_BYTES 256
31#define PC_RSA_SIG_BYTES 256
45#define PC_PKCS1_DIGESTINFO_LEN 19
48#define PC_PKCS1_SHA512_DIGESTINFO_LEN 19
69 const uint8_t *sig,
size_t sig_len,
pc_rsa_hash hash);
pc_rsa_hash
Hash algorithm selecting the RSA signature scheme (RFC 8017 §9.2).
@ SHA256
RSASSA-PKCS1-v1.5 with SHA-256.
@ SHA512
RSASSA-PKCS1-v1.5 with SHA-512.
#define PC_PKCS1_DIGESTINFO_LEN
Length of the DER DigestInfo wrapper for SHA-256 (RFC 8017 / RFC 5754).
#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).
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).
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).
#define PC_PKCS1_SHA512_DIGESTINFO_LEN
Length of the DER DigestInfo wrapper for SHA-512.
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.