aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/mtproto.cpp
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2021-07-08 16:39:34 +0300
committerlevlam <levlam@telegram.org>2021-07-08 16:39:34 +0300
commite9e24282378fcdb3a3ce020bee4253b65ac98213 (patch)
tree1cbdb5fefc4a8ad761f5abe487089902c3efdd6f /test/mtproto.cpp
parentfe4d3cb549d6a05671c0d9d553caf54ad5b6f95c (diff)
Update server keys.
Diffstat (limited to 'test/mtproto.cpp')
-rw-r--r--test/mtproto.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/mtproto.cpp b/test/mtproto.cpp
index 85ce334a9..5e998ff00 100644
--- a/test/mtproto.cpp
+++ b/test/mtproto.cpp
@@ -33,6 +33,7 @@
#include "td/utils/base64.h"
#include "td/utils/common.h"
+#include "td/utils/crypto.h"
#include "td/utils/logging.h"
#include "td/utils/port/Clocks.h"
#include "td/utils/port/IPAddress.h"
@@ -726,11 +727,11 @@ TEST(Mtproto, RSA) {
"8Ygs/ps8e6ct82jLXbnndC9s8HjEvDvBPH9IPjv5JUlmHMBFZ5vFQIfbpo0u0+1P\n"
"n6bkEi5o7/ifoyVv2pAZTRwppTz0EuXD8QIDAQAB\n"
"-----END RSA PUBLIC KEY-----");
- auto rsa = mtproto::RSA::from_pem_public_key(pem).move_as_ok();
+ auto rsa = td::mtproto::RSA::from_pem_public_key(pem).move_as_ok();
ASSERT_EQ(-7596991558377038078, rsa.get_fingerprint());
ASSERT_EQ(256u, rsa.size());
- string s(255, '\0');
- string to(256, '\0');
- ASSERT_EQ(256u, rsa.encrypt(MutableSlice(s).ubegin(), 10, 255, MutableSlice(to).ubegin(), 256));
+ td::string to(256, '\0');
+ rsa.encrypt(pem.substr(0, 256), to);
+ ASSERT_EQ("U2nJEtB2AgpHrm3HB0yhpTQgb0wbesi9Pv/W1v/vULU=", td::base64_encode(td::sha256(to)));
}