Commit 4cadcccc by James Cammarata

Catch pycrypto warning about gmp and show a nice warning on stderr

parent dcd471b9
...@@ -44,6 +44,7 @@ import getpass ...@@ -44,6 +44,7 @@ import getpass
import sys import sys
import textwrap import textwrap
import json import json
import warnings
#import vault #import vault
from vault import VaultLib from vault import VaultLib
...@@ -75,9 +76,20 @@ except: ...@@ -75,9 +76,20 @@ except:
KEYCZAR_AVAILABLE=False KEYCZAR_AVAILABLE=False
try: try:
import keyczar.errors as key_errors from Crypto.pct_warnings import PowmInsecureWarning
from keyczar.keys import AesKey with warnings.catch_warnings(record=True) as warning_handler:
KEYCZAR_AVAILABLE=True warnings.simplefilter("error", PowmInsecureWarning)
try:
import keyczar.errors as key_errors
from keyczar.keys import AesKey
except PowmInsecureWarning:
display("The version of gmp you have installed has a known issue regarding timing vulnerabilities when used with pycrypto. " + \
"If possible, you should update it (ie. yum update gmp).", color="purple", stderr=True)
warnings.resetwarnings()
warnings.simplefilter("ignore")
import keyczar.errors as key_errors
from keyczar.keys import AesKey
KEYCZAR_AVAILABLE=True
except ImportError: except ImportError:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment