OLD | NEW |
1 # Authors: | 1 # Authors: |
2 # Trevor Perrin | 2 # Trevor Perrin |
3 # Dave Baggett (Arcode Corporation) - cleanup handling of constants | 3 # Dave Baggett (Arcode Corporation) - cleanup handling of constants |
4 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 | 4 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 |
5 # | 5 # |
6 # See the LICENSE file for legal information regarding use of this file. | 6 # See the LICENSE file for legal information regarding use of this file. |
7 | 7 |
8 """Class for setting handshake parameters.""" | 8 """Class for setting handshake parameters.""" |
9 | 9 |
10 from .constants import CertificateType | 10 from .constants import CertificateType |
11 from .utils import cryptomath | 11 from .utils import cryptomath |
12 from .utils import cipherfactory | 12 from .utils import cipherfactory |
13 | 13 |
14 CIPHER_NAMES = ["aes128gcm", "rc4", "aes256", "aes128", "3des"] | 14 CIPHER_NAMES = ["aes128gcm", "rc4", "aes256", "aes128", "3des"] |
15 MAC_NAMES = ["sha", "sha256", "aead"] # Don't allow "md5" by default. | 15 MAC_NAMES = ["sha", "sha256", "aead"] # Don't allow "md5" by default. |
16 ALL_MAC_NAMES = MAC_NAMES + ["md5"] | 16 ALL_MAC_NAMES = MAC_NAMES + ["md5"] |
17 KEY_EXCHANGE_NAMES = ["rsa", "dhe_rsa", "srp_sha", "srp_sha_rsa", "dh_anon"] | 17 KEY_EXCHANGE_NAMES = ["rsa", "dhe_rsa", "ecdhe_rsa", "srp_sha", "srp_sha_rsa", "
dh_anon"] |
18 CIPHER_IMPLEMENTATIONS = ["openssl", "pycrypto", "python"] | 18 CIPHER_IMPLEMENTATIONS = ["openssl", "pycrypto", "python"] |
19 CERTIFICATE_TYPES = ["x509"] | 19 CERTIFICATE_TYPES = ["x509"] |
20 TLS_INTOLERANCE_TYPES = ["alert", "close", "reset"] | 20 TLS_INTOLERANCE_TYPES = ["alert", "close", "reset"] |
21 | 21 |
22 class HandshakeSettings(object): | 22 class HandshakeSettings(object): |
23 """This class encapsulates various parameters that can be used with | 23 """This class encapsulates various parameters that can be used with |
24 a TLS handshake. | 24 a TLS handshake. |
25 @sort: minKeySize, maxKeySize, cipherNames, macNames, certificateTypes, | 25 @sort: minKeySize, maxKeySize, cipherNames, macNames, certificateTypes, |
26 minVersion, maxVersion | 26 minVersion, maxVersion |
27 | 27 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return other | 203 return other |
204 | 204 |
205 def _getCertificateTypes(self): | 205 def _getCertificateTypes(self): |
206 l = [] | 206 l = [] |
207 for ct in self.certificateTypes: | 207 for ct in self.certificateTypes: |
208 if ct == "x509": | 208 if ct == "x509": |
209 l.append(CertificateType.x509) | 209 l.append(CertificateType.x509) |
210 else: | 210 else: |
211 raise AssertionError() | 211 raise AssertionError() |
212 return l | 212 return l |
OLD | NEW |