OLD | NEW |
1 # Authors: | 1 # Authors: |
2 # Trevor Perrin | 2 # Trevor Perrin |
3 # Google - added reqCAs parameter | 3 # Google - added reqCAs parameter |
4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support | 4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support |
5 # Dimitris Moraitis - Anon ciphersuites | 5 # Dimitris Moraitis - Anon ciphersuites |
6 # Martin von Loewis - python 3 port | 6 # Martin von Loewis - python 3 port |
7 # | 7 # |
8 # See the LICENSE file for legal information regarding use of this file. | 8 # See the LICENSE file for legal information regarding use of this file. |
9 | 9 |
10 """ | 10 """ |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 # Handle ClientHello and resumption | 1254 # Handle ClientHello and resumption |
1255 for result in self._serverGetClientHello(settings, certChain,\ | 1255 for result in self._serverGetClientHello(settings, certChain,\ |
1256 verifierDB, sessionCache, | 1256 verifierDB, sessionCache, |
1257 anon, fallbackSCSV): | 1257 anon, fallbackSCSV): |
1258 if result in (0,1): yield result | 1258 if result in (0,1): yield result |
1259 elif result == None: | 1259 elif result == None: |
1260 self._handshakeDone(resumed=True) | 1260 self._handshakeDone(resumed=True) |
1261 return # Handshake was resumed, we're done | 1261 return # Handshake was resumed, we're done |
1262 else: break | 1262 else: break |
1263 (clientHello, cipherSuite) = result | 1263 (clientHello, cipherSuite) = result |
| 1264 |
| 1265 # Save the ClientHello for external code to query. |
| 1266 self.clientHello = clientHello |
1264 | 1267 |
1265 #If not a resumption... | 1268 #If not a resumption... |
1266 | 1269 |
1267 # Create the ServerHello message | 1270 # Create the ServerHello message |
1268 if sessionCache: | 1271 if sessionCache: |
1269 sessionID = getRandomBytes(32) | 1272 sessionID = getRandomBytes(32) |
1270 else: | 1273 else: |
1271 sessionID = bytearray(0) | 1274 sessionID = bytearray(0) |
1272 | 1275 |
1273 if not clientHello.supports_npn: | 1276 if not clientHello.supports_npn: |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 except TLSAlert as alert: | 1932 except TLSAlert as alert: |
1930 if not self.fault: | 1933 if not self.fault: |
1931 raise | 1934 raise |
1932 if alert.description not in Fault.faultAlerts[self.fault]: | 1935 if alert.description not in Fault.faultAlerts[self.fault]: |
1933 raise TLSFaultError(str(alert)) | 1936 raise TLSFaultError(str(alert)) |
1934 else: | 1937 else: |
1935 pass | 1938 pass |
1936 except: | 1939 except: |
1937 self._shutdown(False) | 1940 self._shutdown(False) |
1938 raise | 1941 raise |
OLD | NEW |