diff options
author | Kali Kaneko <kali@leap.se> | 2017-07-18 09:54:00 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-07-18 09:56:42 -0400 |
commit | d448fbe951c823d2a79aee6292bb942afa2ee6dc (patch) | |
tree | 580b5d4c955e2c4b0dabda2ded5aa871728b5e9b | |
parent | e0786b9ba6d16ed4895d66af5f5a6c7f78edbf4f (diff) |
[bug] use scrypt lib if an old cryptography found
-rw-r--r-- | src/leap/soledad/client/_scrypt.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/leap/soledad/client/_scrypt.py b/src/leap/soledad/client/_scrypt.py index 2de3ab5e..03dcab40 100644 --- a/src/leap/soledad/client/_scrypt.py +++ b/src/leap/soledad/client/_scrypt.py @@ -15,11 +15,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from cryptography.hazmat.backends.interfaces import ScryptBackend -from cryptography.hazmat.backends import default_backend - -backend = default_backend() -OPENSSL_HAS_SCRYPT = isinstance(backend, ScryptBackend) +try: + from cryptography.hazmat.backends.interfaces import ScryptBackend + from cryptography.hazmat.backends import default_backend + backend = default_backend() + OPENSSL_HAS_SCRYPT = isinstance(backend, ScryptBackend) +except ImportError: + OPENSSL_HAS_SCRYPT = False if OPENSSL_HAS_SCRYPT: from cryptography.hazmat.primitives.kdf.scrypt import Scrypt |