From 5e92533267cb41c42af1243592c530304d18bff5 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 30 Jul 2020 17:33:03 +0300 Subject: [PATCH] Unify quotes --- pygost/asn1schemas/x509.py | 4 ++-- pygost/gost34112012256.py | 4 ++-- pygost/gost34112012512.py | 4 ++-- pygost/gost3413.py | 6 +++--- pygost/pbkdf2.py | 2 +- pygost/test_pfx.py | 4 ++-- setup.py | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pygost/asn1schemas/x509.py b/pygost/asn1schemas/x509.py index ce30f62..188ef3a 100644 --- a/pygost/asn1schemas/x509.py +++ b/pygost/asn1schemas/x509.py @@ -140,8 +140,8 @@ class SubjectKeyIdentifier(KeyIdentifier): class BasicConstraints(Sequence): schema = ( - ('cA', Boolean(default=False)), - # ('pathLenConstraint', PathLenConstraint(optional=True)), + ("cA", Boolean(default=False)), + # ("pathLenConstraint", PathLenConstraint(optional=True)), ) diff --git a/pygost/gost34112012256.py b/pygost/gost34112012256.py index 1f3c62c..865847d 100644 --- a/pygost/gost34112012256.py +++ b/pygost/gost34112012256.py @@ -8,9 +8,9 @@ from pygost.gost34112012 import GOST34112012 class GOST34112012256(GOST34112012): - def __init__(self, data=b''): + def __init__(self, data=b""): super(GOST34112012256, self).__init__(data, digest_size=32) -def new(data=b''): +def new(data=b""): return GOST34112012256(data) diff --git a/pygost/gost34112012512.py b/pygost/gost34112012512.py index 707397d..f02b061 100644 --- a/pygost/gost34112012512.py +++ b/pygost/gost34112012512.py @@ -9,11 +9,11 @@ from pygost.pbkdf2 import pbkdf2 as pbkdf2_base class GOST34112012512(GOST34112012): - def __init__(self, data=b''): + def __init__(self, data=b""): super(GOST34112012512, self).__init__(data, digest_size=64) -def new(data=b''): +def new(data=b""): return GOST34112012512(data) diff --git a/pygost/gost3413.py b/pygost/gost3413.py index 5aeaec6..ec16f8c 100644 --- a/pygost/gost3413.py +++ b/pygost/gost3413.py @@ -274,7 +274,7 @@ Rb128 = 0b10000111 def _mac_ks(encrypter, bs): Rb = Rb128 if bs == 16 else Rb64 - _l = encrypter(bs * b'\x00') + _l = encrypter(bs * b"\x00") k1 = _mac_shift(bs, _l, Rb) if bytearray(_l)[0] & 0x80 > 0 else _mac_shift(bs, _l) k2 = _mac_shift(bs, k1, Rb) if bytearray(k1)[0] & 0x80 > 0 else _mac_shift(bs, k1) return k1, k2 @@ -294,7 +294,7 @@ def mac(encrypter, bs, data): tail_offset = len(data) - bs else: tail_offset = len(data) - (len(data) % bs) - prev = bs * b'\x00' + prev = bs * b"\x00" for i in xrange(0, tail_offset, bs): prev = encrypter(strxor(data[i:i + bs], prev)) tail = data[tail_offset:] @@ -337,7 +337,7 @@ def mac_acpkm_master(algo_class, encrypter, key_section_size, section_size, bs, tail_offset = len(data) - bs else: tail_offset = len(data) - (len(data) % bs) - prev = bs * b'\x00' + prev = bs * b"\x00" sections = len(data) // section_size if len(data) % section_size != 0: sections += 1 diff --git a/pygost/pbkdf2.py b/pygost/pbkdf2.py index d1e07a6..4bef6c6 100644 --- a/pygost/pbkdf2.py +++ b/pygost/pbkdf2.py @@ -28,7 +28,7 @@ def pbkdf2(hasher, password, salt, iterations, dklen): ocpy.update(icpy.digest()) return ocpy.digest() - dkey = b'' + dkey = b"" loop = 1 while len(dkey) < dklen: prev = prf(salt + long2bytes(loop, 4)) diff --git a/pygost/test_pfx.py b/pygost/test_pfx.py index 67fe788..6f06643 100644 --- a/pygost/test_pfx.py +++ b/pygost/test_pfx.py @@ -72,7 +72,7 @@ AwcBAQIDBEAIFX0fyZe20QKKhWm6WYX+S92Gt6zaXroXOvAmayzLfZ5Sd9C2t9zZ JSg6M8RBUYpw/8ym5ou1o2nDa09M5zF3BCCpzyCQBI+rzfISeKvPV1ROfcXiYU93 mwcl1xQV2G5/fgICB9A= """) - password = u'Пароль для PFX' + password = u"Пароль для PFX" def test_shrouded_key_bag(self): private_key_info_expected = b64decode(b""" @@ -162,7 +162,7 @@ ATAMBggqhQMHAQEDAgUAA0EA9oq0Vvk8kkgIwkp0x0J5eKtia4MNTiwKAm7jgnCZIx3O98BThaTX _, outer_safe_contents = pfx["authSafe"]["content"].defined mac_data = pfx["macData"] mac_key = gost34112012_pbkdf2( - password=self.password.encode('utf-8'), + password=self.password.encode("utf-8"), salt=bytes(mac_data["macSalt"]), iterations=int(mac_data["iterations"]), dklen=96, diff --git a/setup.py b/setup.py index a49e097..3daacac 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( "pygost": ["stubs/**/*.pyi"], }, data_files=( - ('', ( + ("", ( "AUTHORS", "COPYING", "FAQ", -- 2.44.0