mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-01 05:02:29 +02:00
Reformat code
This commit is contained in:
parent
3ddb370718
commit
55534ea002
140 changed files with 46068 additions and 48277 deletions
|
@ -14,42 +14,49 @@
|
|||
#include <vector>
|
||||
#include "Identity.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace data
|
||||
{
|
||||
class BlindedPublicKey // for encrypted LS2
|
||||
{
|
||||
public:
|
||||
namespace i2p {
|
||||
namespace data {
|
||||
class BlindedPublicKey // for encrypted LS2
|
||||
{
|
||||
public:
|
||||
|
||||
BlindedPublicKey (std::shared_ptr<const IdentityEx> identity, bool clientAuth = false);
|
||||
BlindedPublicKey (const std::string& b33); // from b33 without .b32.i2p
|
||||
std::string ToB33 () const;
|
||||
BlindedPublicKey(std::shared_ptr<const IdentityEx> identity, bool clientAuth = false);
|
||||
|
||||
const uint8_t * GetPublicKey () const { return m_PublicKey.data (); };
|
||||
size_t GetPublicKeyLen () const { return m_PublicKey.size (); };
|
||||
SigningKeyType GetSigType () const { return m_SigType; };
|
||||
SigningKeyType GetBlindedSigType () const { return m_BlindedSigType; };
|
||||
bool IsValid () const { return GetSigType (); }; // signature type 0 means invalid
|
||||
BlindedPublicKey(const std::string &b33); // from b33 without .b32.i2p
|
||||
std::string ToB33() const;
|
||||
|
||||
void GetSubcredential (const uint8_t * blinded, size_t len, uint8_t * subcredential) const; // 32 bytes
|
||||
size_t GetBlindedKey (const char * date, uint8_t * blindedKey) const; // date is 8 chars "YYYYMMDD", return public key length
|
||||
size_t BlindPrivateKey (const uint8_t * priv, const char * date, uint8_t * blindedPriv, uint8_t * blindedPub) const; // date is 8 chars "YYYYMMDD", return public key length
|
||||
i2p::data::IdentHash GetStoreHash (const char * date = nullptr) const; // date is 8 chars "YYYYMMDD", use current if null
|
||||
const uint8_t *GetPublicKey() const { return m_PublicKey.data(); };
|
||||
|
||||
private:
|
||||
size_t GetPublicKeyLen() const { return m_PublicKey.size(); };
|
||||
|
||||
void GetCredential (uint8_t * credential) const; // 32 bytes
|
||||
void GenerateAlpha (const char * date, uint8_t * seed) const; // 64 bytes, date is 8 chars "YYYYMMDD"
|
||||
void H (const std::string& p, const std::vector<std::pair<const uint8_t *, size_t> >& bufs, uint8_t * hash) const;
|
||||
SigningKeyType GetSigType() const { return m_SigType; };
|
||||
|
||||
private:
|
||||
SigningKeyType GetBlindedSigType() const { return m_BlindedSigType; };
|
||||
|
||||
std::vector<uint8_t> m_PublicKey;
|
||||
i2p::data::SigningKeyType m_SigType, m_BlindedSigType;
|
||||
bool m_IsClientAuth = false;
|
||||
};
|
||||
}
|
||||
bool IsValid() const { return GetSigType(); }; // signature type 0 means invalid
|
||||
|
||||
void GetSubcredential(const uint8_t *blinded, size_t len, uint8_t *subcredential) const; // 32 bytes
|
||||
size_t GetBlindedKey(const char *date,
|
||||
uint8_t *blindedKey) const; // date is 8 chars "YYYYMMDD", return public key length
|
||||
size_t BlindPrivateKey(const uint8_t *priv, const char *date, uint8_t *blindedPriv,
|
||||
uint8_t *blindedPub) const; // date is 8 chars "YYYYMMDD", return public key length
|
||||
i2p::data::IdentHash
|
||||
GetStoreHash(const char *date = nullptr) const; // date is 8 chars "YYYYMMDD", use current if null
|
||||
|
||||
private:
|
||||
|
||||
void GetCredential(uint8_t *credential) const; // 32 bytes
|
||||
void GenerateAlpha(const char *date, uint8_t *seed) const; // 64 bytes, date is 8 chars "YYYYMMDD"
|
||||
void
|
||||
H(const std::string &p, const std::vector<std::pair<const uint8_t *, size_t> > &bufs, uint8_t *hash) const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<uint8_t> m_PublicKey;
|
||||
i2p::data::SigningKeyType m_SigType, m_BlindedSigType;
|
||||
bool m_IsClientAuth = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue