blob: 137817ed18e861bb2be53d1d8850f28ff24fcb1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* kbiffcrypt.h
* Copyright (C) 2005 Michael Hendricks <michael@palmcluster.org>
*
* $Id$
*
*/
#ifndef KBIFFCRYPT_H
#define KBIFFCRYPT_H
#include <qstring.h>
/**
* @brief Useful cryptographic functions for secure authentication
*
* Until QCA
* (<a href='http://delta.affinix.com/qca/'>Qt Cryptographic Architecture</a>)
* becomes more widely available,
* this will be the place for our custom-written, cryptography functions.
* These are mostly needed to implement various forms of secure authentication
* against POP3 or IMAP mail servers.
*/
namespace KBiffCrypt
{
/**
* @brief Calculate HMAC-MD5 of the given text
*
* Calculates the HMAC-MD5 as specified in RFC 2104. The code
* is originally based on the example code provided in the RFC,
* but it has been modified to remove the dependency on the
* OpenSSL libraries. It, instead, depends on KMD5 provided by
* KDE.
*
* The emphasis in writing this function was readability not speed.
* Since the client will authenticate itself against the server
* every couple minutes (at the most), the speed of the function
* is essentially unimportant. The maintainability of the code
* seemed more important. That's not to say that the function is
* slow, it simply hasn't been optimized for speed. If you want
* to call this function several times per second, look elsewhere.
*
* @param text calculate the HMAC-MD5 of this text
* @param key the key used when calculating the HMAC
* @return the HMAC-MD5 value as a string of lower-case, hexadecimal digits
*/
QString hmac_md5(const QString& text, const QString& key);
}
#endif // KBIFFCRYPT_H
|