mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-27 02:04:41 +00:00
36 lines
676 B
C++
36 lines
676 B
C++
#ifndef RSAKEYSPOOL_H
|
|
#define RSAKEYSPOOL_H
|
|
#include <QHash>
|
|
#include <QObject>
|
|
#include <qrsaencryption.h>
|
|
#include <QMutex>
|
|
#include <QMap>
|
|
|
|
namespace ClientProtocol {
|
|
|
|
struct RSAKeyPair {
|
|
QByteArray pub;
|
|
QByteArray priv;
|
|
};
|
|
|
|
typedef QMap<int, RSAKeyPair> KeysPool;
|
|
typedef QHash<QRSAEncryption::Rsa, KeysPool> PoolData;
|
|
class RSAKeysPool: public QObject {
|
|
Q_OBJECT
|
|
private:
|
|
PoolData pool;
|
|
|
|
QMutex multithread;
|
|
|
|
public:
|
|
bool take(QRSAEncryption::Rsa rsa, RSAKeyPair &res);
|
|
void addNewKey(QRSAEncryption::Rsa rsa, const RSAKeyPair& key);
|
|
int size(QRSAEncryption::Rsa rsa) const;
|
|
signals:
|
|
|
|
void sigKeyTaked();
|
|
};
|
|
|
|
}
|
|
#endif // RSAKEYSPOOL_H
|