[botan-devel] Why is max_keylength_of() deprecated and how to avoid using?

William K. Foster wkf at alum.mit.edu
Fri Jun 24 12:04:34 EDT 2011


Hi,

I am getting the following warning going to v1.10.0:

   utl.cpp:524: warning: `max_keylength_of' is deprecated (declared at
../../src/Botan-1.10.0/build/include/botan/lookup.h:320)

But I do not see the path to the non-deprecated code.

The current definition is:

size_t max_keylength_of(const std::string& name)
   {
   Algorithm_Factory& af = global_state().algorithm_factory();

   if(const BlockCipher* bc = af.prototype_block_cipher(name))
      return bc->key_spec().maximum_keylength();

   if(const StreamCipher* sc = af.prototype_stream_cipher(name))
      return sc->key_spec().maximum_keylength();

   if(const MessageAuthenticationCode* mac = af.prototype_mac(name))
      return mac->key_spec().maximum_keylength();

   throw Algorithm_Not_Found(name);
   }


Other than replicating this code, I see no way to avoid this deprecated
interface, I do not understand why it should go away.

I have a name of algorithm and need its maximum keylength.

Thanks.

-William



More information about the botan-devel mailing list