Open reneme opened 1 year ago
Another one: LMS and XMSS both have stateful operation, but there is no generic way to detect how many operations remain on a key. I think the fix here is fairly easy, add std::optional<uint64_t> remaining_operations() const
on Private_Key
which returns nullopt
for non-stateful algorithms.
For the record, here's an example of the hoops one needs to jump through to load a private key that is not wrapped in PKCS#8: https://github.com/randombit/botan/discussions/3902#discussioncomment-8476815.
This is a collection of potential API improvements found in #3609.
pk_algs.h
) The generic functioncreate_private_key()
takes string-typedalgo_name
andalgo_params
to identify the algorithm (see also #3275). In contrastload_{public/private}_key()
requires anAlgorithmIdentifier
object. This is inconvenient, as it requires the user to find a way to translate between the two.Public_Key::raw_public_key_bits()
(https://github.com/randombit/botan/pull/3985) Currently, we providepublic_key_bits()
("BER encoded public key bits") andsubject_public_key()
("X.509 subject key encoding"). Especially the new PQC algorithms seem to converge on their own (concat-based) encodings. Key agreement public keys could make this an alias forPK_Key_Agreement_Key::public_value()
. Other keys might treatraw_public_key_bits()
as an alias for the existingpublic_key_bits()
.std::unique_ptr<Private_Key> Public_Key::generate_another(RNG&)
(https://github.com/randombit/botan/pull/3770) ... to generically generate an equivalent new key pair with the same algorithm (and configuration) as the public key at hand. Use case: Mapping a KEM interface using a Key Agreement algorithm. The abstract "Encaps()" function needs::generate_another()
to conveniently create an ephemeral keypair without knowledge about the exact underlying algorithm.std::optional<uint64_t> Private_Key::remaining_operations() const
(https://github.com/randombit/botan/pull/3821) LMS and XMSS both have stateful operation, but there is no generic way to detect how many operations remain on a key. The proposed method should returnnullopt
for non-stateful algorithms, otherwise the remaining number of valid usages. [1]