aheinecke@467: #ifndef SSLHELP_H aheinecke@467: #define SSLHELP_H aheinecke@452: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@452: * Software engineering by Intevation GmbH aheinecke@452: * aheinecke@452: * This file is Free Software under the GNU GPL (v>=2) aheinecke@452: * and comes with ABSOLUTELY NO WARRANTY! aheinecke@452: * See LICENSE.txt for details. aheinecke@452: */ aheinecke@452: aheinecke@452: aheinecke@452: /** aheinecke@452: * @file sslhelp.h aheinecke@452: * @brief Helper functions to combine Qt with Polarssl aheinecke@452: */ aheinecke@452: #include aheinecke@464: #include aheinecke@452: aheinecke@452: #include aheinecke@452: aheinecke@452: /** @brief get a human readable error message for a polarssl return code aheinecke@452: * aheinecke@452: * @param [in] ret A polarssl error code aheinecke@452: * @returns A QString representation of that error aheinecke@452: */ aheinecke@452: QString getPolarSSLErrorMsg(int ret); aheinecke@464: aheinecke@464: /** @brief calculate the sha256 of the bytearray data aheinecke@464: * aheinecke@464: * @param [in] data The data to hash aheinecke@464: * @returns the sha256sum of the data aheinecke@464: */ aheinecke@464: QByteArray sha256sum(const QByteArray& data); aheinecke@464: andre@1377: /** @brief calculate the sha1 of the bytearray data andre@1377: * andre@1377: * @param [in] data The data to hash andre@1377: * @returns the sha1sum of the data andre@1377: */ andre@1377: QByteArray sha1sum(const QByteArray& data); andre@1377: aheinecke@464: /** @brief Create a RSA signature fur a sha256 hashsum aheinecke@464: * aheinecke@464: * @param [in] hash the hash to sign. aheinecke@464: * @param [in] pk the key to use. aheinecke@464: * @returns the signature of the data or an empty byte array on error aheinecke@464: */ aheinecke@464: QByteArray rsaSignSHA256Hash(const QByteArray& hash, pk_context *pk); aheinecke@467: #endif // SSLHELP_H