Repository navigation
IKemKeyBase
#include <certpp/crypto/keys.hpp> --- certpp::crypto --- implements IKeyBase
Key base for KEM algorithms (see EKems's own doc comment for why this doesn't reuse IAsymmetricKeyBase).
Virtual destructor.
Returns: The key size, in the algorithm's natural unit -- for a fixed-parameter-set algorithm like ML-KEM, its nominal parameter-set label (e.g. 512/768/1024), the same way ESYM_AES's keySize() reports 128/192/256 rather than a continuously variable size.
Returns: Which built-in algorithm produced this key -- e.g. to pick the right SubjectPublicKeyInfo/ciphertext OID when embedding it in a certificate/CMS structure, without the caller having to separately track which IKem it came from.
Reads what a KEM key is, through the base both halves share. The algorithm travels with the key so an encoder can pick the right OID, and keySize() reports the parameter-set label (512/768/1024) rather than a bit count.
// given: const crypto::IKemKeyBasePtr& key
if (key->algorithm() == crypto::EKEM_UNKNOWN) {
return; // never came out of an IKem factory
}
if (key->keySize() < 768) {
return; // ML-KEM-512 is below this deployment's floor
}
COctet encoded;
if (key->serialize(encoded) != ERET_OK) {
return;
}Reference generated from certpp/crypto/keys.hpp at commit 0834b29 (v1.0.1). The header is authoritative --- if this page disagrees with it, the header is right and this page needs regenerating.