|
|
@ -35,11 +35,12 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IdentityEx::IdentityEx (): |
|
|
|
IdentityEx::IdentityEx (): |
|
|
|
m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
m_IsVerifierCreated (false), m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IdentityEx::IdentityEx(const uint8_t * publicKey, const uint8_t * signingKey, SigningKeyType type) |
|
|
|
IdentityEx::IdentityEx(const uint8_t * publicKey, const uint8_t * signingKey, SigningKeyType type): |
|
|
|
|
|
|
|
m_IsVerifierCreated (false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
memcpy (m_StandardIdentity.publicKey, publicKey, sizeof (m_StandardIdentity.publicKey)); |
|
|
|
memcpy (m_StandardIdentity.publicKey, publicKey, sizeof (m_StandardIdentity.publicKey)); |
|
|
|
if (type != SIGNING_KEY_TYPE_DSA_SHA1) |
|
|
|
if (type != SIGNING_KEY_TYPE_DSA_SHA1) |
|
|
@ -135,19 +136,19 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IdentityEx::IdentityEx (const uint8_t * buf, size_t len): |
|
|
|
IdentityEx::IdentityEx (const uint8_t * buf, size_t len): |
|
|
|
m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
m_IsVerifierCreated (false), m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FromBuffer (buf, len); |
|
|
|
FromBuffer (buf, len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IdentityEx::IdentityEx (const IdentityEx& other): |
|
|
|
IdentityEx::IdentityEx (const IdentityEx& other): |
|
|
|
m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
m_IsVerifierCreated (false), m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
*this = other; |
|
|
|
*this = other; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IdentityEx::IdentityEx (const Identity& standard): |
|
|
|
IdentityEx::IdentityEx (const Identity& standard): |
|
|
|
m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
m_IsVerifierCreated (false), m_ExtendedLen (0), m_ExtendedBuffer (nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
*this = standard; |
|
|
|
*this = standard; |
|
|
|
} |
|
|
|
} |
|
|
@ -173,6 +174,7 @@ namespace data |
|
|
|
m_ExtendedBuffer = nullptr; |
|
|
|
m_ExtendedBuffer = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
m_Verifier = nullptr; |
|
|
|
m_Verifier = nullptr; |
|
|
|
|
|
|
|
m_IsVerifierCreated = false; |
|
|
|
|
|
|
|
|
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
@ -187,6 +189,7 @@ namespace data |
|
|
|
m_ExtendedLen = 0; |
|
|
|
m_ExtendedLen = 0; |
|
|
|
|
|
|
|
|
|
|
|
m_Verifier = nullptr; |
|
|
|
m_Verifier = nullptr; |
|
|
|
|
|
|
|
m_IsVerifierCreated = false; |
|
|
|
|
|
|
|
|
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
@ -374,10 +377,16 @@ namespace data |
|
|
|
void IdentityEx::UpdateVerifier (i2p::crypto::Verifier * verifier) const |
|
|
|
void IdentityEx::UpdateVerifier (i2p::crypto::Verifier * verifier) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_Verifier || !verifier) |
|
|
|
if (!m_Verifier || !verifier) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
auto created = m_IsVerifierCreated.exchange (true); |
|
|
|
|
|
|
|
if (!created) |
|
|
|
m_Verifier.reset (verifier); |
|
|
|
m_Verifier.reset (verifier); |
|
|
|
else |
|
|
|
else |
|
|
|
delete verifier; |
|
|
|
delete verifier; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
delete verifier; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void IdentityEx::DropVerifier () const |
|
|
|
void IdentityEx::DropVerifier () const |
|
|
|
{ |
|
|
|
{ |
|
|
|