2018-03-21 08:35:32 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Passport {
|
|
|
|
|
2018-03-27 16:16:00 +04:00
|
|
|
bytes::vector GenerateSecretBytes();
|
2018-03-21 08:35:32 +04:00
|
|
|
|
2018-03-29 18:44:34 +04:00
|
|
|
bytes::vector EncryptSecureSecret(
|
|
|
|
bytes::const_span salt,
|
2018-03-27 16:16:00 +04:00
|
|
|
bytes::const_span secret,
|
2018-03-29 18:44:34 +04:00
|
|
|
bytes::const_span password);
|
2018-03-27 17:00:13 +04:00
|
|
|
bytes::vector DecryptSecureSecret(
|
|
|
|
bytes::const_span salt,
|
|
|
|
bytes::const_span encryptedSecret,
|
|
|
|
bytes::const_span password);
|
2018-03-21 08:35:32 +04:00
|
|
|
|
2018-03-27 16:16:00 +04:00
|
|
|
bytes::vector SerializeData(const std::map<QString, QString> &data);
|
|
|
|
std::map<QString, QString> DeserializeData(bytes::const_span bytes);
|
2018-03-25 15:37:57 +04:00
|
|
|
|
2018-03-21 08:35:32 +04:00
|
|
|
struct EncryptedData {
|
2018-03-27 16:16:00 +04:00
|
|
|
bytes::vector secret;
|
|
|
|
bytes::vector hash;
|
|
|
|
bytes::vector bytes;
|
2018-03-21 08:35:32 +04:00
|
|
|
};
|
|
|
|
|
2018-03-27 16:16:00 +04:00
|
|
|
EncryptedData EncryptData(bytes::const_span bytes);
|
2018-03-25 15:37:57 +04:00
|
|
|
|
2018-03-21 08:35:32 +04:00
|
|
|
EncryptedData EncryptData(
|
2018-03-27 16:16:00 +04:00
|
|
|
bytes::const_span bytes,
|
|
|
|
bytes::const_span dataSecret);
|
|
|
|
|
|
|
|
bytes::vector DecryptData(
|
|
|
|
bytes::const_span encrypted,
|
|
|
|
bytes::const_span dataHash,
|
|
|
|
bytes::const_span dataSecret);
|
|
|
|
|
|
|
|
bytes::vector PrepareValueHash(
|
|
|
|
bytes::const_span dataHash,
|
|
|
|
bytes::const_span valueSecret);
|
|
|
|
|
|
|
|
bytes::vector EncryptValueSecret(
|
|
|
|
bytes::const_span valueSecret,
|
|
|
|
bytes::const_span secret,
|
|
|
|
bytes::const_span valueHash);
|
|
|
|
|
|
|
|
bytes::vector DecryptValueSecret(
|
|
|
|
bytes::const_span encrypted,
|
|
|
|
bytes::const_span secret,
|
|
|
|
bytes::const_span valueHash);
|
|
|
|
|
2018-04-13 22:14:14 +04:00
|
|
|
uint64 CountSecureSecretId(bytes::const_span secret);
|
2018-03-27 17:00:13 +04:00
|
|
|
|
2018-04-12 19:45:04 +04:00
|
|
|
bytes::vector EncryptCredentialsSecret(
|
|
|
|
bytes::const_span secret,
|
|
|
|
bytes::const_span publicKey);
|
|
|
|
|
2018-03-21 08:35:32 +04:00
|
|
|
} // namespace Passport
|