Encrypt a file using Botan library
I don't know the Botan library, so I'll stick to some general recommendations.



Don't include whole namespaces at global scope, especially the std namespace.



The only use of Qt in this function is to accept QString arguments, with which we do nothing but convert to standard strings.  So why not remove the dependency, and allow the function to be used in non-Qt projects, by accepting the filenames as const std::string&amp;?  We can keep the interface by providing a (header-only, trivially inlinable) wrapper separately as a convenience for use with Qt:

//encrypt.h
bool EncryptFile(const std::string&amp; source, const std::string&amp; destination);




//encrypt-qt.h
bool EncryptFile(QString source, QString destination)
{ return EncryptFile(source.toStdString(), destination.toStdString(); }


There's certainly no need to use c_str() when passing to the streams' constructors - a std::string is fine (and expected) there.



I'd probably go one further with the overloads, and provide a version that accepts a pair of streams, so that we could use this for network streaming or in-memory encryption:

//encrypt.h
bool EncryptFile(std::istream&amp; source, std::ostream&amp; destination);

bool EncryptFile(const std::string&amp; source, const std::string&amp; destination);
{
    try {
        std::ifstream in(source, std::ios::binary);
        std::ofstream out(destination, std::ios::binary);
        return EncryptFile(in, out);
    } catch (...) {
        return false;
    }
}




Why do we return true, even if writing the output failed?  For example, try passing /dev/full as the destination.  We could fix that:

return in &amp;&amp; out;


Alternatively, we could arrange for the streams to throw exceptions:

    in.exceptions(std::ifstream::failbit | std::ifstream::bad);
    out.exceptions(std::ifstream::failbit | std::ifstream::bad);