view ui/sslhelp.h @ 1395:a2574a029322

Fix Base 64 signature size calculation. If the signature byte size is not equally dividable by three the base 64 encoding needs three additional bytes. The value is now fixed to avoid such errors in the future.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 26 Jan 2015 13:17:32 +0100
parents c8a6a3e6bdeb
children
line wrap: on
line source
#ifndef SSLHELP_H
#define SSLHELP_H
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */


/**
 * @file sslhelp.h
 * @brief Helper functions to combine Qt with Polarssl
 */
#include <polarssl/error.h>
#include <polarssl/pk.h>

#include <QString>

/** @brief get a human readable error message for a polarssl return code
 *
 * @param [in] ret A polarssl error code
 * @returns A QString representation of that error
 */
QString getPolarSSLErrorMsg(int ret);

/** @brief calculate the sha256 of the bytearray data
 *
 * @param [in] data The data to hash
 * @returns the sha256sum of the data
 */
QByteArray sha256sum(const QByteArray& data);

/** @brief calculate the sha1 of the bytearray data
 *
 * @param [in] data The data to hash
 * @returns the sha1sum of the data
 */
QByteArray sha1sum(const QByteArray& data);

/** @brief Create a RSA signature fur a sha256 hashsum
 *
 * @param [in] hash the hash to sign.
 * @param [in] pk the key to use.
 * @returns the signature of the data or an empty byte array on error
 */
QByteArray rsaSignSHA256Hash(const QByteArray& hash, pk_context *pk);
#endif // SSLHELP_H

http://wald.intevation.org/projects/trustbridge/