aboutsummaryrefslogtreecommitdiff
path: root/oauth2client/crypt.py
AgeCommit message (Collapse)Author
2016-07-27Update imports to only Packages or ModulesPat Ferate
Also cleaned up some nested attribute access.
2016-07-19Update string formatters to new stylePat Ferate
Changing `%` style string formatters to `.format()`. Leaving `logging` strings in old style for Python 2 compatibility. Resolves: Issue #541
2016-02-12Fixing bug where '=' was stripped from signed bytes.Danny Hermes
Fixes #405.
2016-02-04Removing novel crypto in service_account.py.Danny Hermes
2016-02-04Adding a pure Python crypt sub-module.Danny Hermes
Resurrects #1.
2015-09-01Making crypt._verify_signature accept iterable instead of dict.Danny Hermes
2015-09-01Refactor exp/iat checking in crypt.verify_signed_jwt_with_certs.Danny Hermes
Moved check into protected function _verify_time_range.
2015-09-01Refactor audience checking in crypt.verify_signed_jwt_with_certs.Danny Hermes
Moved check into protected function _check_audience.
2015-09-01Using more descriptive names for JWT parts.Danny Hermes
Previous variables in verify_signed_jwt_with_certs did not illustrate the actual use of each part.
2015-09-01Using JWT segment names in verify_signed_jwt_with_certs.Danny Hermes
2015-09-01Refactor certificate checking in crypt.verify_signed_jwt_with_certs.Danny Hermes
Moved check into protected function _verify_signature.
2015-09-01Adding no cover pragmas to test_crypt.Danny Hermes
Also defining the fallback pkcs12_key_as_pem as a top-level method so that we may test it.
2015-08-21Making oauth2client/ files pass PEP8.Danny Hermes
2015-08-21Moving __author__ after imports in oauth2client/.Danny Hermes
This is to address PEP8 E402 as in previous commit.
2015-08-21Docstring pass after pep8ify in oauth2client/Danny Hermes
2015-08-21Raw pep8ify changes.Danny Hermes
Simply ran pep8ify -w oauth2client/ pep8ify -w tests/
2015-08-17Adding _from_bytes helpers as a foil for _to_bytes.Danny Hermes
2015-08-14Unifying all conversions to bytes.Danny Hermes
Also making sure the _urlsafe_b64encode returns bytes and updating dependent code with the change in return type.
2015-08-13Removing import OpenSSL hack.Danny Hermes
No longer needed since the cryptography 1.0 release has fixed the slow import (due to changes in the way cffi was used).
2015-07-13Factoring out conditional code from `crypt.py`.Danny Hermes
Until now, code that depended on PyCrypto or OpenSSL was defined conditionally (e.g. indented) in `crypt.py`. Rather than grouping all these together, we factor out the library specific behavior into standalone modules (but make the modules private / protected). In addition, added a `_helpers.py` module with common behavior that was previously defined in multiple places. Finally, beefed up some test cases so that the three newly added modules had 100% test coverage. Towards #212.
2015-07-02Casting message to bytes in PyCrypto verifier.Danny Hermes
Also - Removing bare `except:` statements in both the PyCrypto and OpenSSL verifiers (in the `verify` method). - Catching the only exception possible in the OpenSSL verifier (it is `OpenSSL.crypto.Error`). - Converting the signature to bytes (if not already) in the OpenSSL verifier. - Adding a test with both a unicode and bytes signature for each verifier. Fixes #201.
2015-05-26Check for OpenSSL.crypto when detecting OpenSSL.Craig Citro
Previously, we assumed that anyone using `OpenSSL` would have installed it via a mechanism like `pip`; this has come back to bite us. We modify our code to look for `OpenSSL.crypto`, not just `OpenSSL`, and add another (unpleasant) test. Fixes #190.
2015-05-19Fall back to importing for OpenSSL detection.Craig Citro
Previously, we'd attempted to detect OpenSSL without actually importing, in order to avoid a runtime penalty for importing `oauth2client`. However, in some exotic situations, `imp.find_module` can fail even though the import would be successful. We tweak to fall back to importing, and add some gross to the corresponding test.
2015-05-15Simplify OpenSSL checks in crypt.py.Craig Citro
Previously, when confirming OpenSSL is installed, we checked that the module was installed, and verified that `crypto.py` was contained in the package directory. However, this can cause issues in cases of non-standard installs. In addition, the `imp.find_module` call already raises an `ImportError` in the case that the module is missing, so this second check isn't needed. Instead, we just drop the explicit check for `crypto.py` in the `OpenSSL` directory.
2015-04-15Deferring OpenSSL import until usage.Danny Hermes
This is to speed up import times. In OpenSSL 0.14 the import takes 0.5 seconds due to cffi on-demand build of extensions in the cryptography library. For classes and functions which are conditionally defined based on the existence of OpenSSL.crypto, we check that the module exists (but don't import it) using imp.find_module.
2015-01-14Moving private_key_as_pem->pkcs12_key_as_pem.Danny Hermes
Also only defining if OpenSSL is installed and conditionally defining a method which raises NotImplementedError if not defined.
2015-01-14Adding protected method to convert PKCS12 key to PEM.Danny Hermes
2014-10-10Fix some trivial issues.INADA Naoki
2014-10-10Merge remote-tracking branch 'origin/master' into python3INADA Naoki
Conflicts: oauth2client/client.py
2014-09-23One more copyright update.Craig Citro
2014-09-23Source cleanup (mostly lint), one missing rename.Craig Citro
This mostly cleans up a few lint errors, normalizes some formatting and import order, etc. I'm not yet attempting to make things lint clean, just making some progress. I also fixed one error with a `simplejson` call that didn't get renamed.
2014-09-23Update all copyright lines.Craig Citro
2014-09-09Revert change of PyCryptoVerifier.verify() since current code turns out working.Jin Liu
modified: oauth2client/crypt.py
2014-09-09Support X509 pem cert and signature verification using PyCrypto.Jin Liu
2014-08-30cleanupINADA Naoki
2014-08-20CleanupINADA Naoki
2014-08-19Merge branch 'master' into six-cleanupINADA Naoki
Conflicts: oauth2client/client.py oauth2client/clientsecrets.py oauth2client/crypt.py oauth2client/file.py oauth2client/gce.py oauth2client/multistore_file.py oauth2client/service_account.py oauth2client/tools.py oauth2client/util.py tests/test_jwt.py tests/test_oauth2client.py tests/test_service_account.py uritemplate/__init__.py
2014-08-19Remove executable bit.INADA Naoki
2014-08-19Fix indent.INADA Naoki
2014-08-18Assorted import/lint cleanup.Craig Citro
This is mostly a cleanup around import statements and a few related pylint issues.
2014-08-18Require python >= 2.6, use the json module.Craig Citro
* Set the minimum version of python to be 2.6, since we don't need to support anything older anymore. * As the first of a series of related cleanups, drop our custom json module (since json is in the stdlib since 2.6).
2014-07-29Handle PKCS12 unicode passwordsJeff Terrace
The load_pkcs12 can't handle passing unicode objects. Instead, encode the given string as bytes before passing to the function.
2014-07-17Try to handle either str or bytes when verifying signature.Pat Ferate
2014-07-17Fixed str -> bytes conversionPat Ferate
2014-07-17Handle str and bytes better in crypto (loading and signing)Pat Ferate
2014-07-17Trying to handle both OpenSSL 0.13 and 0.14.Pat Ferate
Major change in load_pkcs12: 0.13: Need str 0.14: Need bytes
2014-07-17Ensure password is strPat Ferate
2014-07-16More bytes vs str handling.Pat Ferate
2014-07-16Ensure message is in bytesPat Ferate
2014-07-16Added handling for bytes vs str.Pat Ferate