Skip to content

Commit

Permalink
Merge branch 'master' into 218-int
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Sep 5, 2014
2 parents 76c2073 + 286b5fb commit 1a16242
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions paramiko/ecdsakey.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from hashlib import sha256

from ecdsa import SigningKey, VerifyingKey, der, curves
from ecdsa.test_pyecdsa import ECDSA

from paramiko.common import four_byte, one_byte
from paramiko.message import Message
Expand All @@ -51,7 +50,7 @@ def __init__(self, msg=None, data=None, filename=None, password=None, vals=None,
if (msg is None) and (data is not None):
msg = Message(data)
if vals is not None:
self.verifying_key, self.signing_key = vals
self.signing_key, self.verifying_key = vals
else:
if msg is None:
raise SSHException('Key object may not be empty')
Expand Down Expand Up @@ -125,7 +124,7 @@ def write_private_key(self, file_obj, password=None):
key = self.signing_key or self.verifying_key
self._write_private_key('EC', file_obj, key.to_der(), password)

def generate(bits, progress_func=None):
def generate(curve=curves.NIST256p, progress_func=None):
"""
Generate a new private RSA key. This factory function can be used to
generate a new host key or authentication key.
Expand All @@ -138,7 +137,7 @@ def generate(bits, progress_func=None):
@return: new private key
@rtype: L{RSAKey}
"""
signing_key = ECDSA.generate()
signing_key = SigningKey.generate(curve)
key = ECDSAKey(vals=(signing_key, signing_key.get_verifying_key()))
return key
generate = staticmethod(generate)
Expand Down
2 changes: 2 additions & 0 deletions sites/www/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Changelog
=========

* :bug:`335 major` Fix ECDSA key generation (generation of brand new ECDSA keys
was broken previously). Thanks to ``@solarw`` for catch & patch.
* :feature:`184` Support quoted values in SSH config file parsing. Credit to
Yan Kalchevskiy.
* :feature:`131` Add a `~paramiko.sftp_client.SFTPClient.listdir_iter` method
Expand Down

0 comments on commit 1a16242

Please sign in to comment.