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

Bump cryptography from 2.9.2 to 3.0 #261

Closed
wants to merge 1 commit into from

Conversation

dependabot-preview[bot]
Copy link
Contributor

@dependabot-preview dependabot-preview bot commented Jul 21, 2020

Bumps cryptography from 2.9.2 to 3.0.

Changelog

Sourced from cryptography's changelog.

3.0 - 2020-07-20

  • BACKWARDS INCOMPATIBLE: Removed support for passing an ~cryptography.x509.Extension instance to ~cryptography.x509.AuthorityKeyIdentifier.from_issuer_subject_key_identifier, as per our deprecation policy.
  • BACKWARDS INCOMPATIBLE: Support for LibreSSL 2.7.x, 2.8.x, and 2.9.0 has been removed (2.9.1+ is still supported).
  • BACKWARDS INCOMPATIBLE: Dropped support for macOS 10.9, macOS users must upgrade to 10.10 or newer.
  • BACKWARDS INCOMPATIBLE: RSA ~cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key no longer accepts public_exponent values except 65537 and 3 (the latter for legacy purposes).
  • BACKWARDS INCOMPATIBLE: X.509 certificate parsing now enforces that the version field contains a valid value, rather than deferring this check until ~cryptography.x509.Certificate.version is accessed.
  • Deprecated support for Python 2. At the time there is no time table for actually dropping support, however we strongly encourage all users to upgrade their Python, as Python 2 no longer receives support from the Python core team.
  • Added support for OpenSSH serialization format for ec, ed25519, rsa and dsa private keys: ~cryptography.hazmat.primitives.serialization.load_ssh_private_key for loading and ~cryptography.hazmat.primitives.serialization.PrivateFormat.OpenSSH for writing.
  • Added support for OpenSSH certificates to ~cryptography.hazmat.primitives.serialization.load_ssh_public_key.
  • Added ~cryptography.fernet.Fernet.encrypt_at_time and ~cryptography.fernet.Fernet.decrypt_at_time to ~cryptography.fernet.Fernet.
  • Added support for the ~cryptography.x509.SubjectInformationAccess X.509 extension.
  • Added support for parsing ~cryptography.x509.SignedCertificateTimestamps in OCSP responses.
  • Added support for parsing attributes in certificate signing requests via ~cryptography.x509.CertificateSigningRequest.get_attribute_for_oid.
  • Added support for encoding attributes in certificate signing requests via ~cryptography.x509.CertificateSigningRequestBuilder.add_attribute.
  • On OpenSSL 1.1.1d and higher cryptography now uses OpenSSL's built-in CSPRNG instead of its own OS random engine because these versions of OpenSSL properly reseed on fork.
  • Added initial support for creating PKCS12 files with ~cryptography.hazmat.primitives.serialization.pkcs12.serialize_key_and_certificates.
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

@dependabot-preview dependabot-preview bot added the dependencies Pull requests that update a dependency file label Jul 21, 2020
@coveralls
Copy link

coveralls commented Jul 21, 2020

Coverage Status

Coverage decreased (-98.9%) to 0.0% when pulling 84b8e65 on dependabot/pip/cryptography-3.0 into bdcd1b4 on master.

@joshuagl
Copy link
Collaborator

The tests are failing and claiming we're trying to load a DSA key that has fewer than 1024 bits:

ERROR: test_export_pubkey (tests.test_gpg.TestGPGDSA)
export a public key and make sure the parameters are the right ones:
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/secure-systems-lab/securesystemslib/tests/test_gpg.py", line 674, in test_export_pubkey
backends.default_backend())
File "/home/travis/build/secure-systems-lab/securesystemslib/.tox/py37/lib/python3.7/site-packages/cryptography/hazmat/primitives/serialization/ssh.py", line 655, in load_ssh_public_key
public_key, data = kformat.load_public(key_type, data, backend)
File "/home/travis/build/secure-systems-lab/securesystemslib/.tox/py37/lib/python3.7/site-packages/cryptography/hazmat/primitives/serialization/ssh.py", line 296, in load_public
self._validate(public_numbers)
File "/home/travis/build/secure-systems-lab/securesystemslib/.tox/py37/lib/python3.7/site-packages/cryptography/hazmat/primitives/serialization/ssh.py", line 333, in _validate
raise ValueError("SSH supports only 1024 bit DSA keys")
ValueError: SSH supports only 1024 bit DSA keys

however if I look at the test keys with ssh-keygen -l I'm told they are each 2048 bit keys:

% for i in find . -name \*.ssh; do ssh-keygen -l -f $i; done
2048 SHA256:zbkcf58RkXlB4bYQreWUOxR9sV8p+nNOwtL4QCcOh4s openpgp:0xB285DA58 (RSA)
2048 SHA256:q2Y8RIW7I1ZlHxPvwtBwbQhzvMyf47HG9gjDx/paOnc openpgp:0x7E0C8A17 (RSA)
2048 SHA256:FkuEdY2ujYlqWZiVOY4JO/C8cghzLuG751MlNfkkcSs openpgp:0x1C768C43 (RSA)
2048 SHA256:ZtTwtYC06hyQMoxeL0qxVjxj1lBDavMSt3hdWk67WZU openpgp:0xE267B3B1 (DSA)

@dependabot-preview dependabot-preview bot force-pushed the dependabot/pip/cryptography-3.0 branch from 831b083 to 84b8e65 Compare July 27, 2020 12:32
@lukpueh
Copy link
Member

lukpueh commented Aug 4, 2020

It actually doesn't claim that our key has fewer than 1024 bits, but rather that it doesn't have exactly 1024 bits. The restriction was added in pyca/cryptography#5146 and released with 3.0, without any mention of it in the changelog or corresponding commit/PR.

I'm not sure why though, because we were able to load the 2048 bit pub key just fine before. I think I'll open an issue on pyca/cryptography.

@lukpueh
Copy link
Member

lukpueh commented Aug 4, 2020

So it seems the restriction was indeed intended (see pyca/cryptography#5373). The easiest thing to fix this will be to just store the test key in another format, e.g. PEM.

@trishankatdatadog
Copy link
Contributor

The easiest thing to fix this will be to just store the test key in another format, e.g. PEM.

We have a few other options, no?

  • Downgrade the keys to 1024 bits.
  • Remove support for DSA. Do we really need it?

@lukpueh
Copy link
Member

lukpueh commented Aug 6, 2020

We have a few other options, no?

  • Downgrade the keys to 1024 bits.
  • Remove support for DSA. Do we really need it?

Good point. I thought about those too, but decided against them because, downgrading (replacing) the key in the test gpg keychain would have been more work than just changing the format of the pubkey file, and removing DSA support is a bigger decision that I didn't see the need for to make right now.
But yeah, it seems like pyca/cryptography will deprecate DSA at some point and then it might not be worth the effort to find a an alternative crypto library so that we can continue support.

#264 has my PEM fix and successfully tests against cryptography==3.0.

@dependabot-preview
Copy link
Contributor Author

Looks like cryptography is up-to-date now, so this is no longer needed.

@dependabot-preview dependabot-preview bot deleted the dependabot/pip/cryptography-3.0 branch August 6, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants