mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#ifndef GRADIDO_LOGIN_SERVER_MODEL_TABLE_CRYPTO_KEYS_INCLUDE
|
|
#define GRADIDO_LOGIN_SERVER_MODEL_TABLE_CRYPTO_KEYS_INCLUDE
|
|
|
|
#include "ModelBase.h"
|
|
#include "Poco/Types.h"
|
|
|
|
namespace model {
|
|
namespace table {
|
|
|
|
enum KeyType {
|
|
KEY_TYPE_ED25519_SODIUM = 0,
|
|
KEY_TYPE_ED25519_HEDERA = 1,
|
|
KEY_TYPE_COUNT
|
|
};
|
|
|
|
class CryptoKey : public ModelBase
|
|
{
|
|
public:
|
|
CryptoKey();
|
|
CryptoKey(MemoryBin* privateKey, MemoryBin* publicKey, KeyType keyType);
|
|
~CryptoKey();
|
|
|
|
// generic db operations
|
|
const char* getTableName() const { return "crypto_keys"; }
|
|
std::string toString();
|
|
|
|
|
|
static const char* typeToString(KeyType type);
|
|
protected:
|
|
Poco::Data::Statement _loadFromDB(Poco::Data::Session session, const std::string& fieldName);
|
|
Poco::Data::Statement _loadIdFromDB(Poco::Data::Session session);
|
|
Poco::Data::Statement _insertIntoDB(Poco::Data::Session session);
|
|
|
|
Poco::Nullable<Poco::Data::BLOB> mPrivateKey;
|
|
Poco::Nullable<Poco::Data::BLOB> mPublicKey;
|
|
int mKeyType;
|
|
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endif //GRADIDO_LOGIN_SERVER_MODEL_TABLE_CRYPTO_KEYS_INCLUDE
|