Example #1
0
	bool Families::VerifyFamily (const std::string& family, const IdentHash& ident,
		const char * signature, const char * key)
	{
		uint8_t buf[50], signatureBuf[64];
		size_t len = family.length (), signatureLen = strlen (signature);
		if (len + 32 > 50)
		{
			LogPrint (eLogError, "Family: ", family, " is too long");
			return false;
		}

		memcpy (buf, family.c_str (), len);
		memcpy (buf + len, (const uint8_t *)ident, 32);
		len += 32;
		Base64ToByteStream (signature, signatureLen, signatureBuf, 64);
		auto it = m_SigningKeys.find (family);
		if (it != m_SigningKeys.end ())
			return it->second->Verify (buf, len, signatureBuf);
		// TODO: process key
		return true;
	}
Example #2
0
	bool Identity::FromBase64 (const std::string& s)
	{
		size_t count = Base64ToByteStream (s.c_str(), s.length(), publicKey, DEFAULT_IDENTITY_SIZE);
		return count == DEFAULT_IDENTITY_SIZE;
	}
Example #3
0
	bool Identity::FromBase64 (const std::string& s)
	{
		size_t count = Base64ToByteStream (s.c_str(), s.length(), publicKey, sizeof (Identity));
		return count == sizeof(Identity);
	}