botan-rs
botan-rs copied to clipboard
Stringly-typed API inerited from the C FFI is hard to discover
While porting Sequoia to Botan, I spent quite a bit of time grepping/reading Botan's source and stepping through the library in order to find the right strings to pass to various constructors like Cipher::new
and Privkey::create
to specify the algorithm, or methods like Privkey::sign
to specify the padding scheme.
I think defining enums for algorithms, cipher modes, and padding schemes and any kind of argument that is currently a string would make the interface much nicer and more discoverable.
Thanks for raising this issue. There are some similar debates happening wrt the C++ API, but there the situation is harder as C++ enums are so limited :sob: but there is no reason we could not provide Rust enumerations that then map to the expected FFI string.