Mercurial > trustbridge
comparison ui/sslhelp.h @ 464:2e100d3e414a
Add helper functions for sha256 sum and rsa signing
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 23 Apr 2014 15:33:42 +0000 |
parents | f8b480b08532 |
children | 5ebee91c0bb8 |
comparison
equal
deleted
inserted
replaced
463:5200b8e9b2ae | 464:2e100d3e414a |
---|---|
10 /** | 10 /** |
11 * @file sslhelp.h | 11 * @file sslhelp.h |
12 * @brief Helper functions to combine Qt with Polarssl | 12 * @brief Helper functions to combine Qt with Polarssl |
13 */ | 13 */ |
14 #include <polarssl/error.h> | 14 #include <polarssl/error.h> |
15 #include <polarssl/pk.h> | |
15 | 16 |
16 #include <QString> | 17 #include <QString> |
17 | 18 |
18 /** @brief get a human readable error message for a polarssl return code | 19 /** @brief get a human readable error message for a polarssl return code |
19 * | 20 * |
20 * @param [in] ret A polarssl error code | 21 * @param [in] ret A polarssl error code |
21 * @returns A QString representation of that error | 22 * @returns A QString representation of that error |
22 */ | 23 */ |
23 QString getPolarSSLErrorMsg(int ret); | 24 QString getPolarSSLErrorMsg(int ret); |
25 | |
26 /** @brief calculate the sha256 of the bytearray data | |
27 * | |
28 * @param [in] data The data to hash | |
29 * @returns the sha256sum of the data | |
30 */ | |
31 QByteArray sha256sum(const QByteArray& data); | |
32 | |
33 /** @brief Create a RSA signature fur a sha256 hashsum | |
34 * | |
35 * @param [in] hash the hash to sign. | |
36 * @param [in] pk the key to use. | |
37 * @returns the signature of the data or an empty byte array on error | |
38 */ | |
39 QByteArray rsaSignSHA256Hash(const QByteArray& hash, pk_context *pk); |