diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-08-04 18:05:23 +0200 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-08-04 18:05:23 +0200 |
commit | f2c3b4fd619a08a31fa49b11a0814e86169f4088 (patch) | |
tree | b453bc7ac0794923bd9063cdf74466ad7ddc69ba /rsa | |
parent | 3c5ee594a2e38b27f086d042d9d2b9d7d0d0269d (diff) | |
download | rsa-git-f2c3b4fd619a08a31fa49b11a0814e86169f4088.tar.gz |
Added flake8 as development dependency and fixed reported issues
Diffstat (limited to 'rsa')
-rw-r--r-- | rsa/__init__.py | 2 | ||||
-rw-r--r-- | rsa/_compat.py | 2 | ||||
-rw-r--r-- | rsa/cli.py | 10 | ||||
-rw-r--r-- | rsa/key.py | 3 | ||||
-rw-r--r-- | rsa/pkcs1.py | 7 | ||||
-rw-r--r-- | rsa/transform.py | 2 |
6 files changed, 12 insertions, 14 deletions
diff --git a/rsa/__init__.py b/rsa/__init__.py index 41f1557..3f928d9 100644 --- a/rsa/__init__.py +++ b/rsa/__init__.py @@ -39,4 +39,4 @@ if __name__ == "__main__": __all__ = ["newkeys", "encrypt", "decrypt", "sign", "verify", 'PublicKey', 'PrivateKey', 'DecryptionError', 'VerificationError', - 'compute_hash', 'sign_hash'] + 'find_signature_hash', 'compute_hash', 'sign_hash'] diff --git a/rsa/_compat.py b/rsa/_compat.py index b31331e..46bf6fa 100644 --- a/rsa/_compat.py +++ b/rsa/_compat.py @@ -16,8 +16,6 @@ """Python compatibility wrappers.""" -import itertools -import sys from struct import pack @@ -37,7 +37,7 @@ def keygen() -> None: # Parse the CLI options parser = optparse.OptionParser(usage='usage: %prog [options] keysize', - description='Generates a new RSA keypair of "keysize" bits.') + description='Generates a new RSA keypair of "keysize" bits.') parser.add_option('--pubout', type='string', help='Output filename for the public key. The public key is ' @@ -203,7 +203,7 @@ class EncryptOperation(CryptoOperation): operation_progressive = 'encrypting' def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey, - cli_args: Indexable=()): + cli_args: Indexable = ()): """Encrypts files.""" assert isinstance(pub_key, rsa.key.PublicKey) return rsa.encrypt(indata, pub_key) @@ -221,7 +221,7 @@ class DecryptOperation(CryptoOperation): key_class = rsa.PrivateKey def perform_operation(self, indata: bytes, priv_key: rsa.key.AbstractKey, - cli_args: Indexable=()): + cli_args: Indexable = ()): """Decrypts files.""" assert isinstance(priv_key, rsa.key.PrivateKey) return rsa.decrypt(indata, priv_key) @@ -244,7 +244,7 @@ class SignOperation(CryptoOperation): 'to stdout if this option is not present.') def perform_operation(self, indata: bytes, priv_key: rsa.key.AbstractKey, - cli_args: Indexable): + cli_args: Indexable): """Signs files.""" assert isinstance(priv_key, rsa.key.PrivateKey) @@ -271,7 +271,7 @@ class VerifyOperation(CryptoOperation): has_output = False def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey, - cli_args: Indexable): + cli_args: Indexable): """Verifies files.""" assert isinstance(pub_key, rsa.key.PublicKey) @@ -118,7 +118,8 @@ class AbstractKey: return method(keyfile) @staticmethod - def _assert_format_exists(file_format: str, methods: typing.Mapping[str, typing.Callable]) -> typing.Callable: + def _assert_format_exists(file_format: str, methods: typing.Mapping[str, typing.Callable]) \ + -> typing.Callable: """Checks whether the given file format exists in 'methods'. """ diff --git a/rsa/pkcs1.py b/rsa/pkcs1.py index f810771..6378777 100644 --- a/rsa/pkcs1.py +++ b/rsa/pkcs1.py @@ -33,14 +33,13 @@ import os import sys import typing +from . import common, transform, core, key + if sys.version_info < (3, 6): # Python 3.6 and newer have SHA-3 support. For Python 3.5 we need a third party library. # This library monkey-patches the hashlib module so that it looks like Python actually # supports SHA-3 natively. - import sha3 - - -from . import common, transform, core, key + import sha3 # noqa: F401 # ASN.1 codes that describe the hash algorithm used. HASH_ASN1 = { diff --git a/rsa/transform.py b/rsa/transform.py index bce9f74..4cd99bb 100644 --- a/rsa/transform.py +++ b/rsa/transform.py @@ -36,7 +36,7 @@ def bytes2int(raw_bytes: bytes) -> int: return int.from_bytes(raw_bytes, 'big', signed=False) -def int2bytes(number: int, fill_size: int=0) -> bytes: +def int2bytes(number: int, fill_size: int = 0) -> bytes: """ Convert an unsigned integer to bytes (big-endian):: |