[Botan-devel] load_key() functions

Boris boriss at web.de
Tue Sep 25 14:27:15 EDT 2007


Hi everyone, 

the various PKCS8::load_key() and X509::load_key() functions all return a
pointer to Private_Key respectively Public_Key. From what I understand the
keys are dynamically allocated and ownership is passed to the caller (which
means the caller must not forget to delete the keys)? If that is true
wouldn't it be better to return std::auto_ptr<Private_Key> respectively
std::auto_ptr<Public_Key>? And what is the reason why the keys are
dynamically allocated (instead of returning a pointer the functions could
return a copy of the keys which seems to be possible as the copy
constructors are not private)? Or are there good reasons not to copy the
keys around (something I shouldn't do in my application then either)? 

Thanks again for any enlightenment, :) 
Boris 




More information about the botan-devel mailing list