diff 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
line wrap: on
line diff
--- a/ui/sslhelp.h	Wed Apr 23 15:33:09 2014 +0000
+++ b/ui/sslhelp.h	Wed Apr 23 15:33:42 2014 +0000
@@ -12,6 +12,7 @@
  * @brief Helper functions to combine Qt with Polarssl
  */
 #include <polarssl/error.h>
+#include <polarssl/pk.h>
 
 #include <QString>
 
@@ -21,3 +22,18 @@
  * @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 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);

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