mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-09 11:27:53 +00:00
load Ident from base64 string
This commit is contained in:
parent
cf6fa2d41d
commit
19333d5697
@ -6,6 +6,7 @@
|
|||||||
#include <cryptopp/dsa.h>
|
#include <cryptopp/dsa.h>
|
||||||
#include "CryptoConst.h"
|
#include "CryptoConst.h"
|
||||||
#include "Identity.h"
|
#include "Identity.h"
|
||||||
|
#include "base64.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
@ -17,6 +18,12 @@ namespace data
|
|||||||
memcpy (publicKey, keys.publicKey, sizeof (publicKey) + sizeof (signingKey));
|
memcpy (publicKey, keys.publicKey, sizeof (publicKey) + sizeof (signingKey));
|
||||||
memset (certificate, 0, sizeof (certificate));
|
memset (certificate, 0, sizeof (certificate));
|
||||||
return *this;
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Identity::FromBase64 (const std::string& s)
|
||||||
|
{
|
||||||
|
size_t count = Base64ToByteStream (s.c_str(), s.length(), reinterpret_cast<uint8_t*> (this), sizeof (Identity));
|
||||||
|
return count == sizeof(Identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateKeys& PrivateKeys::operator=(const Keys& keys)
|
PrivateKeys& PrivateKeys::operator=(const Keys& keys)
|
||||||
|
@ -32,6 +32,7 @@ namespace data
|
|||||||
uint8_t certificate[3];
|
uint8_t certificate[3];
|
||||||
|
|
||||||
Identity& operator=(const Keys& keys);
|
Identity& operator=(const Keys& keys);
|
||||||
|
bool FromBase64(const std::string&);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PrivateKeys // for eepsites
|
struct PrivateKeys // for eepsites
|
||||||
|
Loading…
Reference in New Issue
Block a user