i2pd/libi2pd/Family.h

49 lines
1.0 KiB
C
Raw Normal View History

/*
2022-03-24 19:50:20 +00:00
* Copyright (c) 2013-2022, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
* See full license text in LICENSE file at top of project tree
*/
2016-02-18 20:57:43 +00:00
#ifndef FAMILY_H__
2016-02-21 01:20:19 +00:00
#define FAMILY_H__
2016-02-18 20:57:43 +00:00
#include <map>
#include <string>
#include <memory>
#include "Signature.h"
#include "Identity.h"
2016-02-18 20:57:43 +00:00
namespace i2p
{
namespace data
{
2022-03-24 19:50:20 +00:00
typedef int FamilyID;
2016-02-18 20:57:43 +00:00
class Families
{
public:
Families ();
~Families ();
void LoadCertificates ();
2018-01-06 03:48:51 +00:00
bool VerifyFamily (const std::string& family, const IdentHash& ident,
2022-03-24 19:50:20 +00:00
const char * signature, const char * key = nullptr) const;
FamilyID GetFamilyID (const std::string& family) const;
2016-02-18 20:57:43 +00:00
private:
void LoadCertificate (const std::string& filename);
private:
2022-03-24 19:50:20 +00:00
std::map<std::string, std::pair<std::shared_ptr<i2p::crypto::Verifier>, FamilyID> > m_SigningKeys; // family -> (verifier, id)
2018-01-06 03:48:51 +00:00
};
2016-02-21 01:20:19 +00:00
std::string CreateFamilySignature (const std::string& family, const IdentHash& ident);
// return base64 signature of empty string in case of failure
2016-02-18 20:57:43 +00:00
}
}
#endif