aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/src/rw/ut_large
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/tvmauth/src/rw/ut_large
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/tvmauth/src/rw/ut_large')
-rw-r--r--library/cpp/tvmauth/src/rw/ut_large/gen/main.cpp32
-rw-r--r--library/cpp/tvmauth/src/rw/ut_large/gen/ya.make14
-rw-r--r--library/cpp/tvmauth/src/rw/ut_large/test.py35
-rw-r--r--library/cpp/tvmauth/src/rw/ut_large/ya.make17
4 files changed, 98 insertions, 0 deletions
diff --git a/library/cpp/tvmauth/src/rw/ut_large/gen/main.cpp b/library/cpp/tvmauth/src/rw/ut_large/gen/main.cpp
new file mode 100644
index 0000000000..31a599c996
--- /dev/null
+++ b/library/cpp/tvmauth/src/rw/ut_large/gen/main.cpp
@@ -0,0 +1,32 @@
+#include <library/cpp/tvmauth/src/rw/keys.h>
+
+#include <library/cpp/string_utils/base64/base64.h>
+
+#include <util/generic/yexception.h>
+
+using namespace NTvmAuth;
+
+const TString DATA = "my magic data";
+
+int main(int, char**) {
+ const NRw::TKeyPair pair = NRw::GenKeyPair(1024);
+ const NRw::TRwPrivateKey priv(pair.Private, 0);
+ const NRw::TRwPublicKey pub(pair.Public);
+
+ Cout << "data='" << DATA << "'."
+ << "private='" << Base64Encode(pair.Private) << "'."
+ << "public='" << Base64Encode(pair.Public) << "'.";
+
+ TString sign;
+ try {
+ sign = priv.SignTicket(DATA);
+ Cout << "sign='" << Base64Encode(sign) << "'.";
+ Y_ENSURE(pub.CheckSign(DATA, sign));
+ } catch (const std::exception& e) {
+ Cout << "what='" << e.what() << "'" << Endl;
+ return 1;
+ }
+ Cout << Endl;
+
+ return 0;
+}
diff --git a/library/cpp/tvmauth/src/rw/ut_large/gen/ya.make b/library/cpp/tvmauth/src/rw/ut_large/gen/ya.make
new file mode 100644
index 0000000000..7b62d5c726
--- /dev/null
+++ b/library/cpp/tvmauth/src/rw/ut_large/gen/ya.make
@@ -0,0 +1,14 @@
+PROGRAM()
+
+OWNER(g:passport_infra)
+
+SRCS(
+ main.cpp
+)
+
+PEERDIR(
+ library/cpp/string_utils/base64
+ library/cpp/tvmauth/src/rw
+)
+
+END()
diff --git a/library/cpp/tvmauth/src/rw/ut_large/test.py b/library/cpp/tvmauth/src/rw/ut_large/test.py
new file mode 100644
index 0000000000..0cf95d9848
--- /dev/null
+++ b/library/cpp/tvmauth/src/rw/ut_large/test.py
@@ -0,0 +1,35 @@
+from __future__ import print_function
+
+import os
+import subprocess
+import sys
+
+import yatest.common as yc
+
+
+def test_fuzzing():
+ errfile = './errfile'
+ outfile = './outfile'
+ env = os.environ.copy()
+
+ for number in range(25000):
+ with open(errfile, 'w') as fe:
+ with open(outfile, 'w') as fo:
+ p = subprocess.Popen(
+ [
+ yc.build_path('library/cpp/tvmauth/src/rw/ut_large/gen/gen'),
+ ],
+ env=env,
+ stdout=fo,
+ stderr=fe,
+ )
+ code = p.wait()
+
+ with open(errfile) as fe:
+ all = fe.read()
+ if all != '':
+ with open(outfile) as fo:
+ print(fo.read(), file=sys.stderr)
+ assert all == ''
+
+ assert code == 0
diff --git a/library/cpp/tvmauth/src/rw/ut_large/ya.make b/library/cpp/tvmauth/src/rw/ut_large/ya.make
new file mode 100644
index 0000000000..54f82065e7
--- /dev/null
+++ b/library/cpp/tvmauth/src/rw/ut_large/ya.make
@@ -0,0 +1,17 @@
+PY2TEST()
+
+OWNER(g:passport_infra)
+
+TEST_SRCS(test.py)
+
+DEPENDS(library/cpp/tvmauth/src/rw/ut_large/gen)
+
+TAG(ya:fat)
+
+SIZE(LARGE)
+
+END()
+
+RECURSE(
+ gen
+)