Skip to content

Commit 7491f1c

Browse files
committed
Merge
2 parents 09954e9 + d36076b commit 7491f1c

File tree

2 files changed

+41
-42
lines changed

2 files changed

+41
-42
lines changed

doc/scapy/installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ Graphs (conversations)
421421

422422
WEP decryption
423423

424-
* `PyCrypto <http://www.dlitz.net/software/pycrypto/>`_: `pycrypto-2.0.1.win32-py2.5.zip <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=pycrypto-2.0.1.win32-py2.5.zip>`_ `pycrypto-2.0.1.win32-py2.6.exe <http://www.voidspace.org.uk/downloads/pycrypto-2.0.1.win32-py2.6.exe>`_
424+
* `PyCrypto <http://www.dlitz.net/software/pycrypto/>`_: `pycrypto-2.1.0.win32-py2.5.zip <http://www.voidspace.org.uk/downloads/pycrypto-2.1.0.win32-py2.5.zip>`_ `pycrypto-2.1.0.win32-py2.6.zip <http://www.voidspace.org.uk/downloads/pycrypto-2.1.0.win32-py2.6.zip>`_
425425

426426
Fingerprinting
427427

scapy/crypto/cert.py

+40-41
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@ def create_temporary_ca_path(anchor_list, folder):
405405

406406
class OSSLHelper:
407407
def _apply_ossl_cmd(self, osslcmd, rawdata):
408-
r,w=popen2.popen2(osslcmd)
409-
w.write(rawdata)
410-
w.close()
411-
res = r.read()
412-
r.close()
413-
return res
408+
r,w=popen2.popen2(osslcmd)
409+
w.write(rawdata)
410+
w.close()
411+
res = r.read()
412+
r.close()
413+
return res
414414

415415
class _EncryptAndVerify:
416416
### Below are encryption methods
@@ -1183,14 +1183,14 @@ def __init__(self, keypath):
11831183
rawkey = f.read()
11841184
f.close()
11851185
except:
1186-
raise Exception(error_msg)
1186+
raise Exception(error_msg)
11871187
else:
11881188
rawkey = keypath
11891189

1190-
if rawkey is None:
1191-
raise Exception(error_msg)
1190+
if rawkey is None:
1191+
raise Exception(error_msg)
11921192

1193-
self.rawkey = rawkey
1193+
self.rawkey = rawkey
11941194

11951195
# Let's try to get file format : PEM or DER.
11961196
fmtstr = 'openssl rsa -text -pubin -inform %s -noout '
@@ -1228,15 +1228,15 @@ def __init__(self, keypath):
12281228
textkey = r.read()
12291229
r.close()
12301230
res = e.read()
1231-
if res == '':
1232-
self.format = "DER"
1231+
if res == '':
1232+
self.format = "DER"
12331233
self.derkey = rawkey
12341234
self.textkey = textkey
12351235
cmd = convertstr % ("DER", "PEM")
12361236
self.pemkey = self._apply_ossl_cmd(cmd, rawkey)
12371237
cmd = convertstr % ("DER", "DER")
12381238
self.derkey = self._apply_ossl_cmd(cmd, rawkey)
1239-
else:
1239+
else:
12401240
try: # Perhaps it is a cert
12411241
c = Cert(keypath)
12421242
except:
@@ -1343,14 +1343,14 @@ def __init__(self, keypath):
13431343
rawkey = f.read()
13441344
f.close()
13451345
except:
1346-
raise Exception(error_msg)
1346+
raise Exception(error_msg)
13471347
else:
13481348
rawkey = keypath
13491349

1350-
if rawkey is None:
1351-
raise Exception(error_msg)
1350+
if rawkey is None:
1351+
raise Exception(error_msg)
13521352

1353-
self.rawkey = rawkey
1353+
self.rawkey = rawkey
13541354

13551355
# Let's try to get file format : PEM or DER.
13561356
fmtstr = 'openssl rsa -text -inform %s -noout '
@@ -1388,16 +1388,16 @@ def __init__(self, keypath):
13881388
textkey = r.read()
13891389
r.close()
13901390
res = e.read()
1391-
if res == '':
1392-
self.format = "DER"
1391+
if res == '':
1392+
self.format = "DER"
13931393
self.derkey = rawkey
13941394
self.textkey = textkey
13951395
cmd = convertstr % ("DER", "PEM")
13961396
self.pemkey = self._apply_ossl_cmd(cmd, rawkey)
13971397
cmd = convertstr % ("DER", "DER")
13981398
self.derkey = self._apply_ossl_cmd(cmd, rawkey)
1399-
else:
1400-
raise Exception(error_msg)
1399+
else:
1400+
raise Exception(error_msg)
14011401

14021402
self.osslcmdbase = 'openssl rsa -inform %s ' % self.format
14031403

@@ -1534,14 +1534,14 @@ def __init__(self, certpath):
15341534
rawcert = f.read()
15351535
f.close()
15361536
except:
1537-
raise Exception(error_msg)
1537+
raise Exception(error_msg)
15381538
else:
15391539
rawcert = certpath
15401540

1541-
if rawcert is None:
1542-
raise Exception(error_msg)
1541+
if rawcert is None:
1542+
raise Exception(error_msg)
15431543

1544-
self.rawcert = rawcert
1544+
self.rawcert = rawcert
15451545

15461546
# Let's try to get file format : PEM or DER.
15471547
fmtstr = 'openssl x509 -text -inform %s -noout '
@@ -1579,16 +1579,16 @@ def __init__(self, certpath):
15791579
textcert = r.read()
15801580
r.close()
15811581
res = e.read()
1582-
if res == '':
1583-
self.format = "DER"
1582+
if res == '':
1583+
self.format = "DER"
15841584
self.dercert = rawcert
15851585
self.textcert = textcert
15861586
cmd = convertstr % ("DER", "PEM")
15871587
self.pemcert = self._apply_ossl_cmd(cmd, rawcert)
15881588
cmd = convertstr % ("DER", "DER")
15891589
self.dercert = self._apply_ossl_cmd(cmd, rawcert)
1590-
else:
1591-
raise Exception(error_msg)
1590+
else:
1591+
raise Exception(error_msg)
15921592

15931593
self.osslcmdbase = 'openssl x509 -inform %s ' % self.format
15941594

@@ -1823,7 +1823,7 @@ def __init__(self, certpath):
18231823
# X509v3 Key Usage
18241824
self.keyUsage = []
18251825
v = fields_dict[" X509v3 Key Usage:"]
1826-
if v:
1826+
if v:
18271827
# man 5 x509v3_config
18281828
ku_mapping = {"Digital Signature": "digitalSignature",
18291829
"Non Repudiation": "nonRepudiation",
@@ -1848,7 +1848,7 @@ def __init__(self, certpath):
18481848
# X509v3 Extended Key Usage
18491849
self.extKeyUsage = []
18501850
v = fields_dict[" X509v3 Extended Key Usage:"]
1851-
if v:
1851+
if v:
18521852
# man 5 x509v3_config:
18531853
eku_mapping = {"TLS Web Server Authentication": "serverAuth",
18541854
"TLS Web Client Authentication": "clientAuth",
@@ -2016,7 +2016,7 @@ def remainingDays(self, now=None):
20162016
# return SHA-1 hash of cert embedded public key
20172017
# !! At the moment, the trailing 0 is in the hashed string if any
20182018
def keyHash(self):
2019-
m = self.modulus_hexdump
2019+
m = self.modulus_hexdump
20202020
res = []
20212021
i = 0
20222022
l = len(m)
@@ -2230,14 +2230,14 @@ def __init__(self, crlpath):
22302230
rawcrl = f.read()
22312231
f.close()
22322232
except:
2233-
raise Exception(error_msg)
2233+
raise Exception(error_msg)
22342234
else:
22352235
rawcrl = crlpath
22362236

2237-
if rawcrl is None:
2238-
raise Exception(error_msg)
2237+
if rawcrl is None:
2238+
raise Exception(error_msg)
22392239

2240-
self.rawcrl = rawcrl
2240+
self.rawcrl = rawcrl
22412241

22422242
# Let's try to get file format : PEM or DER.
22432243
fmtstr = 'openssl crl -text -inform %s -noout '
@@ -2275,16 +2275,16 @@ def __init__(self, crlpath):
22752275
textcrl = r.read()
22762276
r.close()
22772277
res = e.read()
2278-
if res == '':
2279-
self.format = "DER"
2278+
if res == '':
2279+
self.format = "DER"
22802280
self.dercrl = rawcrl
22812281
self.textcrl = textcrl
22822282
cmd = convertstr % ("DER", "PEM")
22832283
self.pemcrl = self._apply_ossl_cmd(cmd, rawcrl)
22842284
cmd = convertstr % ("DER", "DER")
22852285
self.dercrl = self._apply_ossl_cmd(cmd, rawcrl)
2286-
else:
2287-
raise Exception(error_msg)
2286+
else:
2287+
raise Exception(error_msg)
22882288

22892289
self.osslcmdbase = 'openssl crl -inform %s ' % self.format
22902290

@@ -2475,4 +2475,3 @@ def verify(self, anchors):
24752475

24762476

24772477

2478-

0 commit comments

Comments
 (0)