Skip to content

Switched everything to use cryptography instead of pyCrypto - #394

Merged
bitprophet merged 64 commits into
paramiko:masterfrom
alex:switch-to-cryptography
Apr 25, 2016
Merged

bitprophet merged 64 commits into
paramiko:masterfrom
alex:switch-to-cryptography

Conversation

@alex

@alex alex commented Sep 15, 2014

Copy link
Copy Markdown
Member

Motivation:

  • Adds PyPy support
  • Performance improvement
  • OpenSSL and friends are better audited than PyCrypto
  • Easier windows install flow (Cryptography provides statically linked wheels
    on Windows)

This PR is basically complete on the code side, of course it can always use
more review :-)

Tests all pass locally (tested with PyPy!)

Still needs some docs work, and to figure out how to do this with the version
numbers so people's stuff doesn't suddenly get broken.

@alex

alex commented Sep 15, 2014

Copy link
Copy Markdown
Member Author

Oh, this also requires cryptography master right now, we need to get a release out before this is usable; that's no problem though.

@alex

alex commented Sep 15, 2014

Copy link
Copy Markdown
Member Author

Oh -- this also adds pyasn1 as a dependency, it's a pretty small thing, and could be used to replace some of the existing BER stuff in the future. (We can also remove the ecdsa requirement and just use cryptography as well)

Comment thread paramiko/rsakey.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does 65537 mean here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

65537 is the public_exponent here, it's generally considered a good default (it's what PyCrypto uses). Would passing it as a keyword-argument make this easier?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. :)

@lndbrg

lndbrg commented Sep 16, 2014

Copy link
Copy Markdown
Contributor

Some tests seems to be failing on CPython. Is that due to requiring master of cryptography?

If you'd like to add pypy and pypy3 to the .travis.yml that would be good, so we'll get those tested as well.

@lndbrg

lndbrg commented Sep 16, 2014

Copy link
Copy Markdown
Contributor

Also, is there any significant speed difference going from PyCrypto to cryptography?

@lndbrg

lndbrg commented Sep 16, 2014

Copy link
Copy Markdown
Contributor

Most of it looks good though. :) I will look at it a couple of times more to see if i discover something else.

@reaperhulk

Copy link
Copy Markdown
Contributor

@lndbrg I don't believe any of the core developers have conducted a serious benchmark of pyca/cryptography against pycrypto, but I'd expect them to be broadly similar.

The CPython failures are due to a function required for this PR not being present in the currently released version of pyca/cryptography (0.5.4). We'll be releasing a new version of the library soon to correct this (and add some new features).

@lndbrg

lndbrg commented Sep 16, 2014

Copy link
Copy Markdown
Contributor

Would it be okay to ask you to try to transfer, say a 100M file, one with this branch and one with pycrypto? :)

@alex

alex commented Sep 16, 2014

Copy link
Copy Markdown
Member Author

I haven't benchmarked it with paramiko, but the last time I benchmarked PyCrypto vs Cryptography (this was for DKIM, which is all RSA) it was many many times faster, 6x IIRC.

If you can show me how to benchmark transfering a 100MB file with paramiko, I'm happy to do so :-)

@lndbrg

lndbrg commented Sep 17, 2014

Copy link
Copy Markdown
Contributor

Cool. There is a test called test_sftp_big.py that transfers a 1MB file, running that should probably suffice. :)

@lndbrg

lndbrg commented Sep 17, 2014

Copy link
Copy Markdown
Contributor

@reaperhulk when the new version is released and we get a green run in travis i'll have another look. 👍

@bitprophet

Copy link
Copy Markdown
Member

SO EXCITED

@bitprophet

Copy link
Copy Markdown
Member

Actual comments, without reading the diffs yet:

  • Re: versions: if this only added pure-Python deps, it would be a minor release (eg we added ecdsa support in 1.13 or so) as it adds no "real" dependency - users able to install paramiko beforehand can still install after.
    • However, unless I'm missing something, Cryptography requires OpenSSL & PyCrypto doesn't (PyCrypto only needs regular Python dev headers and I'm reasonably sure those don't themselves require OpenSSL?)
    • If that's accurate I may just say "ok this is now Paramiko 2.0, but there are no API changes, only dependency changes" - perhaps unusual, but honoring semver nonetheless.
  • Re: ecdsa being subsumed, that's fine, and is also more fodder for making it a 2.0 level change (though not a hard requirement).
  • Re: pyasn1, that's already one of the optional requirements for the merged-but-unreleased Kerberos/GSSAPI support, so this just makes it non-optional.

Comment thread paramiko/ecdsakey.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, this junk here is some old epydoc syntax. I just fixed it (& scanned for any more elsewhere) and updated master. You'll probably need to update to account.

Conflicts:
	paramiko/ecdsakey.py
	tests/test_client.py
Comment thread sites/www/installing.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the "precompiled source / packages" bit removed? Are there no plans to distribute Cryptography via OS channels?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in some OSes already (Debian), but not enough that I thought it was
worth noting; disagree?

On Thu, Sep 18, 2014 at 6:01 PM, Jeff Forcier [email protected]
wrote:

In sites/www/installing.rst:

C extension


-Unless you are installing from a precompiled source such as a Debian apt
-repository or RedHat RPM, or using :ref:pypm <pypm>, you will also need the
-ability to build Python C-based modules from source in order to install
-PyCrypto. Users on Unix-based platforms such as Ubuntu or Mac OS X will

Why was the "precompiled source / packages" bit removed? Are there no
plans to distribute Cryptography via OS channels?

—
Reply to this email directly or view it on GitHub
https://github.com/paramiko/paramiko/pull/394/files#r17764948.

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, Paramiko is presently packaged on a number of distros (who also usually package PyCrypto) and I'd expect this to continue, even if it means maintainers need to start packaging Cryptography too. Either way I think the note is useful for some newbies and doesn't harm anything by existing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely think that as maintainers of distro packages update Parmaiko
they'll package cryptography, if it isn't already available, and we'll work
with those maintainers. (We're also in FreeBSD, adn some other weird
distros :-) and work closely with those upstream maintainers).

On Thu, Sep 18, 2014 at 6:19 PM, Jeff Forcier [email protected]
wrote:

In sites/www/installing.rst:

C extension


-Unless you are installing from a precompiled source such as a Debian apt
-repository or RedHat RPM, or using :ref:pypm <pypm>, you will also need the
-ability to build Python C-based modules from source in order to install
-PyCrypto. Users on Unix-based platforms such as Ubuntu or Mac OS X will

Well, Paramiko is presently packaged on a number of distros (who also
usually package PyCrypto) and I'd expect this to continue, even if it means
maintainers need to start packaging Cryptography too. Either way I think
the note is useful for some newbies and doesn't harm anything by existing.

—
Reply to this email directly or view it on GitHub
https://github.com/paramiko/paramiko/pull/394/files#r17765412.

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

@bitprophet

Copy link
Copy Markdown
Member

Added some line notes (see above), otherwise this looks good to me at a glance. I haven't yet installed master Cryptography to test it out though.

@alex

alex commented Sep 19, 2014

Copy link
Copy Markdown
Member Author

Pushed a fix for the merge conflict and the docs issue you noted.

On Thu, Sep 18, 2014 at 6:04 PM, Jeff Forcier [email protected]
wrote:

Added some line notes (see above), otherwise this looks good to me at a
glance. I haven't yet installed master Cryptography to test it out though.

—
Reply to this email directly or view it on GitHub
#394 (comment).

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

@bitprophet bitprophet added this to the 2.0 milestone Sep 19, 2014
@reaperhulk

Copy link
Copy Markdown
Contributor

Mostly looks good. Only comment I have is that "plus development headers for Python, OpenSSL and CFFI" should probably read "plus development headers for Python, OpenSSL and libffi", as libffi is cffi's C dependency.

@bitprophet

Copy link
Copy Markdown
Member

Updated, thanks!

@bitprophet

Copy link
Copy Markdown
Member

Posted http://bitprophet.org/blog/2016/04/23/paramiko-2.0-is-coming/ so this doesn't catch everyone 100% flat-footed when it comes out :3

I'm off to bang on 1.16.1; some of its tickets may get bumped to 1.17.0; once those are both squared away I am probably going to declare master "2.0" and merge this.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 72.326% when pulling 69b995a on alex:switch-to-cryptography into 1cda0eb on paramiko:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 72.339% when pulling 69b995a on alex:switch-to-cryptography into 1cda0eb on paramiko:master.

@bitprophet
bitprophet merged commit 69b995a into paramiko:master Apr 25, 2016
@alex
alex deleted the switch-to-cryptography branch April 25, 2016 03:22
@alex

alex commented Apr 25, 2016

Copy link
Copy Markdown
Member Author

\o/

Thanks! Feel free to CC me on any issues should there be follow up necessary.

@bitprophet

Copy link
Copy Markdown
Member

Did initial prep work for release:

  • Branched old master as 1.17 so that can be released (it's tiny, 1.16.1 will be much bigger changelog-wise)
  • Updated my integration branch (which has some of its own changes, as above, mostly docs) with alex's branch and master (been working on bugfixes a lot today). Looks ok
  • Merged that to master and pushed, which is why this is merged now :3

I plan to release 1.16.1, 1.17.0 and 2.0.0 tomorrow if all goes well. Thanks a billion, Alex, you have the patience of a saint.

@bitprophet

Copy link
Copy Markdown
Member

Feel free to CC me on any issues should there be follow up necessary.

You know I will 😆

@drewfisher314

Copy link
Copy Markdown

Outstanding!

On Apr 24, 2016, at 9:21 PM, Jeff Forcier [email protected] wrote:

Merged #394.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

bitprophet added a commit that referenced this pull request Apr 25, 2016
@techtonik

Copy link
Copy Markdown

👍

@Julian

Julian commented Apr 25, 2016

Copy link
Copy Markdown

@alex @bitprophet and others, all y'all are great. Thanks!

@bitprophet

Copy link
Copy Markdown
Member

Quick note, still planning to get this out ASAP, been banging on an update to my changelog library so it can actually support 1.0 -> 2.0 transitions gracefully. Mostly done with that now. Computers.

@alex

alex commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

@bitprophet Sounds good, let me know if you need anything.

florianluediger added a commit to instantshare/instantshare that referenced this pull request May 16, 2016
Paramiko has switched from PyCrypto to Cryptography as backend.
This makes the installation in Windows much easier.
See paramiko/paramiko#394 for more information.
asfgit pushed a commit to apache/impala that referenced this pull request Aug 24, 2018
Upgrade Paramiko to the latest, 2.4.1. Paramiko drastically changed its
dependencies in Paramiko 2, dropping defunct Pycrypto and using Cryptography
instead.

paramiko/paramiko#637
paramiko/paramiko#394

This change implicitly removes the dependency on Pycrypto.

Also upgrade Fabric to the latest 1.x version, 1.14.0.

Testing:
- This works in my development environment.
- This works in my downstream stress and query gen environments.
- This works when doing a full data load.
- Impala still builds on a variety of OSs.

Change-Id: I0636d8113be449953420e1d5773f63d7c91943e3
Reviewed-on: http://gerrit.cloudera.org:8080/11308
Reviewed-by: Philip Zeyliger <[email protected]>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
cloudera-hudson pushed a commit to cloudera/Impala that referenced this pull request Dec 17, 2018
Upgrade Paramiko to the latest, 2.4.1. Paramiko drastically changed its
dependencies in Paramiko 2, dropping defunct Pycrypto and using Cryptography
instead.

paramiko/paramiko#637
paramiko/paramiko#394

This change implicitly removes the dependency on Pycrypto.

Also upgrade Fabric to the latest 1.x version, 1.14.0.

Testing:
- This works in my development environment.
- This works in my downstream stress and query gen environments.
- This works when doing a full data load.
- Impala still builds on a variety of OSs.

Change-Id: I0636d8113be449953420e1d5773f63d7c91943e3
Reviewed-on: http://gerrit.cloudera.org:8080/11308
Reviewed-by: Philip Zeyliger <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.