Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkey: remove progress_func from pkey generate() methods #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions demos/demo_keygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,8 @@
}


def progress(arg=None):
if not arg:
sys.stdout.write('0%\x08\x08\x08 ')
sys.stdout.flush()
elif arg[0] == 'p':
sys.stdout.write('25%\x08\x08\x08\x08 ')
sys.stdout.flush()
elif arg[0] == 'h':
sys.stdout.write('50%\x08\x08\x08\x08 ')
sys.stdout.flush()
elif arg[0] == 'x':
sys.stdout.write('75%\x08\x08\x08\x08 ')
sys.stdout.flush()


if __name__ == '__main__':
phrase = None
pfunc = None

parser = OptionParser(usage=usage)
parser.add_option("-t", "--type", type="string", dest="ktype",
Expand Down Expand Up @@ -96,7 +80,6 @@ def progress(arg=None):
phrase = getattr(options, 'newphrase')

if options.verbose:
pfunc = progress
sys.stdout.write("Generating priv/pub %s %d bits key pair (%s/%s.pub)..."
% (ktype, bits, filename, filename))
sys.stdout.flush()
Expand All @@ -108,7 +91,7 @@ def progress(arg=None):
raise SSHException("Unknown %s algorithm to generate keys pair" % ktype)

# generating private key
prv = key_dispatch_table[ktype].generate(bits=bits, progress_func=pfunc)
prv = key_dispatch_table[ktype].generate(bits=bits)
prv.write_private_key_file(filename, password=phrase)

# generating public key
Expand Down
3 changes: 1 addition & 2 deletions paramiko/dsskey.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@ def write_private_key(self, file_obj, password=None):
)

@staticmethod
def generate(bits=1024, progress_func=None):
def generate(bits=1024):
"""
Generate a new private DSS key. This factory function can be used to
generate a new host key or authentication key.

:param int bits: number of bits the generated key should be.
:param progress_func: Unused
:return: new `.DSSKey` private key
"""
numbers = dsa.generate_private_key(
Expand Down
3 changes: 1 addition & 2 deletions paramiko/ecdsakey.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,11 @@ def write_private_key(self, file_obj, password=None):
)

@classmethod
def generate(cls, curve=ec.SECP256R1(), progress_func=None, bits=None):
def generate(cls, curve=ec.SECP256R1(), bits=None):
"""
Generate a new private ECDSA key. This factory function can be used to
generate a new host key or authentication key.

:param progress_func: Not used for this type of key.
:returns: A new private key (`.ECDSAKey`) object
"""
if bits is not None:
Expand Down
3 changes: 1 addition & 2 deletions paramiko/rsakey.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ def write_private_key(self, file_obj, password=None):
)

@staticmethod
def generate(bits, progress_func=None):
def generate(bits):
"""
Generate a new private RSA key. This factory function can be used to
generate a new host key or authentication key.

:param int bits: number of bits the generated key should be.
:param progress_func: Unused
:return: new `.RSAKey` private key
"""
key = rsa.generate_private_key(
Expand Down