-
Notifications
You must be signed in to change notification settings - Fork 79
/
constants.py
1468 lines (1269 loc) · 56.6 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Authors:
# Trevor Perrin
# Google - defining ClientCertificateType
# Google (adapted by Sam Rushing) - NPN support
# Dimitris Moraitis - Anon ciphersuites
# Dave Baggett (Arcode Corporation) - canonicalCipherName
# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#
# See the LICENSE file for legal information regarding use of this file.
from .utils.compat import a2b_hex
"""Constants used in various places."""
# protocol version number used for negotiating TLS 1.3 between implementations
# of the draft specification
# DEPRECATED!
TLS_1_3_DRAFT = (3, 4)
# ServerHello.random value meaning that the message is a HelloRetryRequest
TLS_1_3_HRR = a2b_hex("CF21AD74E59A6111BE1D8C021E65B891"
"C2A211167ABB8C5E079E09E2C8A8339C")
# last bytes of ServerHello.random to be used when negotiating TLS 1.1 or
# earlier while supporting TLS 1.2 or greater
TLS_1_1_DOWNGRADE_SENTINEL = a2b_hex("444F574E47524400")
# last bytes of ServerHello.random to be used when negotiating TLS 1.2
# while supporting TLS 1.3 or greater
TLS_1_2_DOWNGRADE_SENTINEL = a2b_hex("444F574E47524401")
class TLSEnum(object):
"""Base class for different enums of TLS IDs"""
@classmethod
def _recursiveVars(cls, klass):
"""Call vars recursively on base classes"""
fields = dict()
for basecls in klass.__bases__:
fields.update(cls._recursiveVars(basecls))
fields.update(dict(vars(klass)))
return fields
@classmethod
def toRepr(cls, value, blacklist=None):
"""
Convert numeric type to string representation
name if found, None otherwise
"""
fields = cls._recursiveVars(cls)
if blacklist is None:
blacklist = []
return next((key for key, val in fields.items() \
if key not in ('__weakref__', '__dict__', '__doc__',
'__module__') and \
key not in blacklist and \
val == value), None)
@classmethod
def toStr(cls, value, blacklist=None):
"""Convert numeric type to human-readable string if possible"""
ret = cls.toRepr(value, blacklist)
if ret is not None:
return ret
else:
return '{0}'.format(value)
class CertificateType(TLSEnum):
x509 = 0
openpgp = 1
class ClientCertificateType(TLSEnum):
rsa_sign = 1
dss_sign = 2
rsa_fixed_dh = 3
dss_fixed_dh = 4
ecdsa_sign = 64 # RFC 8422
rsa_fixed_ecdh = 65 # RFC 8422
ecdsa_fixed_ecdh = 66 # RFC 8422
class SSL2HandshakeType(TLSEnum):
"""SSL2 Handshake Protocol message types."""
error = 0
client_hello = 1
client_master_key = 2
client_finished = 3
server_hello = 4
server_verify = 5
server_finished = 6
request_certificate = 7
client_certificate = 8
class SSL2ErrorDescription(TLSEnum):
"""SSL2 Handshake protocol error message descriptions"""
no_cipher = 0x0001
no_certificate = 0x0002
bad_certificate = 0x0004
unsupported_certificate_type = 0x0006
class HandshakeType(TLSEnum):
"""Message types in TLS Handshake protocol"""
hello_request = 0
client_hello = 1
server_hello = 2
new_session_ticket = 4
hello_retry_request = 6 # draft version of TLS 1.3
encrypted_extensions = 8
certificate = 11
server_key_exchange = 12
certificate_request = 13
server_hello_done = 14
certificate_verify = 15
client_key_exchange = 16
finished = 20
certificate_status = 22
key_update = 24 # TLS 1.3
next_protocol = 67
message_hash = 254 # TLS 1.3
class ContentType(TLSEnum):
"""TLS record layer content types of payloads"""
change_cipher_spec = 20
alert = 21
handshake = 22
application_data = 23
heartbeat = 24 # RFC 6520
all = (20, 21, 22, 23, 24)
@classmethod
def toRepr(cls, value, blacklist=None):
"""Convert numeric type to name representation"""
if blacklist is None:
blacklist = []
blacklist.append('all')
return super(ContentType, cls).toRepr(value, blacklist)
class ExtensionType(TLSEnum):
"""TLS Extension Type registry values"""
server_name = 0 # RFC 6066 / 4366
status_request = 5 # RFC 6066 / 4366
cert_type = 9 # RFC 6091
supported_groups = 10 # RFC 4492, RFC-ietf-tls-negotiated-ff-dhe-10
ec_point_formats = 11 # RFC 4492
srp = 12 # RFC 5054
signature_algorithms = 13 # RFC 5246
heartbeat = 15 # RFC 6520
alpn = 16 # RFC 7301
client_hello_padding = 21 # RFC 7685
encrypt_then_mac = 22 # RFC 7366
extended_master_secret = 23 # RFC 7627
record_size_limit = 28 # RFC 8449
extended_random = 40 # draft-rescorla-tls-extended-random-02
pre_shared_key = 41 # TLS 1.3
early_data = 42 # TLS 1.3
supported_versions = 43 # TLS 1.3
cookie = 44 # TLS 1.3
psk_key_exchange_modes = 45 # TLS 1.3
post_handshake_auth = 49 # TLS 1.3
signature_algorithms_cert = 50 # TLS 1.3
key_share = 51 # TLS 1.3
supports_npn = 13172
tack = 0xF300
renegotiation_info = 0xff01 # RFC 5746
class HashAlgorithm(TLSEnum):
"""Hash algorithm IDs used in TLSv1.2"""
none = 0
md5 = 1
sha1 = 2
sha224 = 3
sha256 = 4
sha384 = 5
sha512 = 6
intrinsic = 8 # RFC 8422
class SignatureAlgorithm(TLSEnum):
"""Signing algorithms used in TLSv1.2"""
anonymous = 0
rsa = 1
dsa = 2
ecdsa = 3
ed25519 = 7 # RFC 8422
ed448 = 8 # RFC 8422
class SignatureScheme(TLSEnum):
"""
Signature scheme used for signalling supported signature algorithms.
This is the replacement for the HashAlgorithm and SignatureAlgorithm
lists. Introduced with TLSv1.3.
"""
rsa_pkcs1_sha1 = (2, 1)
rsa_pkcs1_sha224 = (3, 1)
rsa_pkcs1_sha256 = (4, 1)
rsa_pkcs1_sha384 = (5, 1)
rsa_pkcs1_sha512 = (6, 1)
ecdsa_secp256r1_sha256 = (4, 3)
ecdsa_secp384r1_sha384 = (5, 3)
ecdsa_secp521r1_sha512 = (6, 3)
rsa_pss_rsae_sha256 = (8, 4)
rsa_pss_rsae_sha384 = (8, 5)
rsa_pss_rsae_sha512 = (8, 6)
ed25519 = (8, 7) # RFC 8422
ed448 = (8, 8) # RFC 8422
rsa_pss_pss_sha256 = (8, 9)
rsa_pss_pss_sha384 = (8, 10)
rsa_pss_pss_sha512 = (8, 11)
# backwards compatibility (for TLS1.2)
rsa_pss_sha256 = (8, 4)
rsa_pss_sha384 = (8, 5)
rsa_pss_sha512 = (8, 6)
@classmethod
def toRepr(cls, value, blacklist=None):
"""Convert numeric type to name representation"""
if blacklist is None:
blacklist = []
blacklist += ['getKeyType', 'getPadding', 'getHash',
'rsa_pss_sha256', 'rsa_pss_sha384', 'rsa_pss_sha512']
return super(SignatureScheme, cls).toRepr(value, blacklist)
@staticmethod
def getKeyType(scheme):
"""
Return the name of the signature algorithm used in scheme.
E.g. for "rsa_pkcs1_sha1" it returns "rsa"
"""
# they need to be threated as ECDSA algorithms, see RFC 8422
if scheme in ("ed25519", "ed448"):
return "ecdsa"
try:
getattr(SignatureScheme, scheme)
except AttributeError:
raise ValueError("\"{0}\" scheme is unknown".format(scheme))
vals = scheme.split('_', 4)
return vals[0]
@staticmethod
def getPadding(scheme):
"""Return the name of padding scheme used in signature scheme."""
try:
getattr(SignatureScheme, scheme)
except AttributeError:
raise ValueError("\"{0}\" scheme is unknown".format(scheme))
vals = scheme.split('_', 4)
assert len(vals) in (3, 4)
if len(vals) == 3:
kType, padding, _ = vals
else:
kType, padding, _, _ = vals
assert kType == 'rsa'
return padding
@staticmethod
def getHash(scheme):
"""Return the name of hash used in signature scheme."""
# there is no explicit hash in the EDDSA, see RFC 8422
if scheme in ("ed25519", "ed448"):
return "intrinsic"
try:
getattr(SignatureScheme, scheme)
except AttributeError:
raise ValueError("\"{0}\" scheme is unknown".format(scheme))
vals = scheme.split('_', 4)
assert len(vals) in (3, 4)
if len(vals) == 3:
kType, _, hName = vals
else:
kType, _, _, hName = vals
assert kType in ('rsa', 'ecdsa')
return hName
class GroupName(TLSEnum):
"""Name of groups supported for (EC)DH key exchange"""
# RFC4492
sect163k1 = 1
sect163r1 = 2
sect163r2 = 3
sect193r1 = 4
sect193r2 = 5
sect233k1 = 6
sect233r1 = 7
sect239k1 = 8
sect283k1 = 9
sect283r1 = 10
sect409k1 = 11
sect409r1 = 12
sect571k1 = 13
sect571r1 = 14
secp160k1 = 15
secp160r1 = 16
secp160r2 = 17
secp192k1 = 18
secp192r1 = 19
secp224k1 = 20
secp224r1 = 21
secp256k1 = 22
secp256r1 = 23
secp384r1 = 24
secp521r1 = 25
allEC = list(range(1, 26))
# RFC7027
brainpoolP256r1 = 26
brainpoolP384r1 = 27
brainpoolP512r1 = 28
allEC.extend(list(range(26, 29)))
# draft-ietf-tls-rfc4492bis
x25519 = 29
x448 = 30
allEC.extend(list(range(29, 31)))
# RFC7919
ffdhe2048 = 256
ffdhe3072 = 257
ffdhe4096 = 258
ffdhe6144 = 259
ffdhe8192 = 260
allFF = list(range(256, 261))
all = allEC + allFF
@classmethod
def toRepr(cls, value, blacklist=None):
"""Convert numeric type to name representation"""
if blacklist is None:
blacklist = []
blacklist += ['all', 'allEC', 'allFF']
return super(GroupName, cls).toRepr(value, blacklist)
# groups forbidden by RFC 8443 section B.3.1.5
TLS_1_3_FORBIDDEN_GROUPS = set(range(1, 0x17))
TLS_1_3_FORBIDDEN_GROUPS.update(range(0x1A, 0x1D))
TLS_1_3_FORBIDDEN_GROUPS.update([0xff01, 0xff02])
TLS_1_3_FORBIDDEN_GROUPS = frozenset(TLS_1_3_FORBIDDEN_GROUPS)
class ECPointFormat(TLSEnum):
"""Names and ID's of supported EC point formats."""
uncompressed = 0
ansiX962_compressed_prime = 1
ansiX962_compressed_char2 = 2
all = [uncompressed,
ansiX962_compressed_prime,
ansiX962_compressed_char2]
@classmethod
def toRepr(cls, value, blacklist=None):
"""Convert numeric type to name representation."""
if blacklist is None:
blacklist = []
blacklist.append('all')
return super(ECPointFormat, cls).toRepr(value, blacklist)
class ECCurveType(TLSEnum):
"""Types of ECC curves supported in TLS from RFC4492"""
explicit_prime = 1
explicit_char2 = 2
named_curve = 3
class NameType(TLSEnum):
"""Type of entries in Server Name Indication extension."""
host_name = 0
class CertificateStatusType(TLSEnum):
"""Type of responses in the status_request and CertificateStatus msgs."""
ocsp = 1
class HeartbeatMode(TLSEnum):
"""Types of heartbeat modes from RFC 6520"""
PEER_ALLOWED_TO_SEND = 1
PEER_NOT_ALLOWED_TO_SEND = 2
class HeartbeatMessageType(TLSEnum):
"""Types of heartbeat messages from RFC 6520"""
heartbeat_request = 1
heartbeat_response = 2
class KeyUpdateMessageType(TLSEnum):
"""Types of keyupdate messages from RFC 8446"""
update_not_requested = 0
update_requested = 1
class AlertLevel(TLSEnum):
"""Enumeration of TLS Alert protocol levels"""
warning = 1
fatal = 2
class AlertDescription(TLSEnum):
"""
:cvar bad_record_mac: A TLS record failed to decrypt properly.
If this occurs during a SRP handshake it most likely
indicates a bad password. It may also indicate an implementation
error, or some tampering with the data in transit.
This alert will be signalled by the server if the SRP password is bad.
It
may also be signalled by the server if the SRP username is unknown to
the
server, but it doesn't wish to reveal that fact.
:cvar handshake_failure: A problem occurred while handshaking.
This typically indicates a lack of common ciphersuites between client
and
server, or some other disagreement (about SRP parameters or key sizes,
for example).
:cvar protocol_version: The other party's SSL/TLS version was unacceptable.
This indicates that the client and server couldn't agree on which
version
of SSL or TLS to use.
:cvar user_canceled: The handshake is being cancelled for some reason.
"""
close_notify = 0
unexpected_message = 10
bad_record_mac = 20
decryption_failed = 21
record_overflow = 22
decompression_failure = 30
handshake_failure = 40
no_certificate = 41 #SSLv3
bad_certificate = 42
unsupported_certificate = 43
certificate_revoked = 44
certificate_expired = 45
certificate_unknown = 46
illegal_parameter = 47
unknown_ca = 48
access_denied = 49
decode_error = 50
decrypt_error = 51
export_restriction = 60
protocol_version = 70
insufficient_security = 71
internal_error = 80
inappropriate_fallback = 86
user_canceled = 90
no_renegotiation = 100
missing_extension = 109
unsupported_extension = 110 # RFC 5246
certificate_unobtainable = 111 # RFC 6066
unrecognized_name = 112 # RFC 6066
bad_certificate_status_response = 113 # RFC 6066
bad_certificate_hash_value = 114 # RFC 6066
unknown_psk_identity = 115
certificate_required = 116 # RFC 8446
no_application_protocol = 120 # RFC 7301
class PskKeyExchangeMode(TLSEnum):
"""Values used in the PSK Key Exchange Modes extension."""
psk_ke = 0
psk_dhe_ke = 1
class CipherSuite:
"""
Numeric values of ciphersuites and ciphersuite types
:cvar tripleDESSuites: ciphersuties which use 3DES symmetric cipher in CBC
mode
:cvar aes128Suites: ciphersuites which use AES symmetric cipher in CBC mode
with 128 bit key
:cvar aes256Suites: ciphersuites which use AES symmetric cipher in CBC mode
with 256 bit key
:cvar rc4Suites: ciphersuites which use RC4 symmetric cipher with 128 bit
key
:cvar shaSuites: ciphersuites which use SHA-1 HMAC integrity mechanism
and protocol default Pseudo Random Function
:cvar sha256Suites: ciphersuites which use SHA-256 HMAC integrity mechanism
and SHA-256 Pseudo Random Function
:cvar md5Suites: ciphersuites which use MD-5 HMAC integrity mechanism and
protocol default Pseudo Random Function
:cvar srpSuites: ciphersuites which use Secure Remote Password (SRP) key
exchange protocol
:cvar srpCertSuites: ciphersuites which use Secure Remote Password (SRP)
key exchange protocol with RSA server authentication
:cvar srpAllSuites: all SRP ciphersuites, pure SRP and with RSA based
server authentication
:cvar certSuites: ciphersuites which use RSA key exchange with RSA server
authentication
:cvar certAllSuites: ciphersuites which use RSA server authentication
:cvar anonSuites: ciphersuites which use anonymous Finite Field
Diffie-Hellman key exchange
:cvar ietfNames: dictionary with string names of the ciphersuites
"""
ietfNames = {}
# the ciphesuite names come from IETF, we want to keep them
#pylint: disable = invalid-name
# SSLv2 from draft-hickman-netscape-ssl-00.txt
SSL_CK_RC4_128_WITH_MD5 = 0x010080
ietfNames[0x010080] = 'SSL_CK_RC4_128_WITH_MD5'
SSL_CK_RC4_128_EXPORT40_WITH_MD5 = 0x020080
ietfNames[0x020080] = 'SSL_CK_RC4_128_EXPORT40_WITH_MD5'
SSL_CK_RC2_128_CBC_WITH_MD5 = 0x030080
ietfNames[0x030080] = 'SSL_CK_RC2_128_CBC_WITH_MD5'
SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 = 0x040080
ietfNames[0x040080] = 'SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5'
SSL_CK_IDEA_128_CBC_WITH_MD5 = 0x050080
ietfNames[0x050080] = 'SSL_CK_IDEA_128_CBC_WITH_MD5'
SSL_CK_DES_64_CBC_WITH_MD5 = 0x060040
ietfNames[0x060040] = 'SSL_CK_DES_64_CBC_WITH_MD5'
SSL_CK_DES_192_EDE3_CBC_WITH_MD5 = 0x0700C0
ietfNames[0x0700C0] = 'SSL_CK_DES_192_EDE3_CBC_WITH_MD5'
#: SSL2 ciphersuites which use RC4 symmetric cipher
ssl2rc4 = []
ssl2rc4.append(SSL_CK_RC4_128_WITH_MD5)
ssl2rc4.append(SSL_CK_RC4_128_EXPORT40_WITH_MD5)
#: SSL2 ciphersuites which use RC2 symmetric cipher
ssl2rc2 = []
ssl2rc2.append(SSL_CK_RC2_128_CBC_WITH_MD5)
ssl2rc2.append(SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5)
#: SSL2 ciphersuites which use IDEA symmetric cipher
ssl2idea = [SSL_CK_IDEA_128_CBC_WITH_MD5]
#: SSL2 ciphersuites which use (single) DES symmetric cipher
ssl2des = [SSL_CK_DES_64_CBC_WITH_MD5]
#: SSL2 ciphersuites which use 3DES symmetric cipher
ssl2_3des = [SSL_CK_DES_192_EDE3_CBC_WITH_MD5]
#: SSL2 ciphersuites which encrypt only part (40 bits) of the key
ssl2export = []
ssl2export.append(SSL_CK_RC4_128_EXPORT40_WITH_MD5)
ssl2export.append(SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5)
#: SSL2 ciphersuties which use 128 bit key
ssl2_128Key = []
ssl2_128Key.append(SSL_CK_RC4_128_WITH_MD5)
ssl2_128Key.append(SSL_CK_RC4_128_EXPORT40_WITH_MD5)
ssl2_128Key.append(SSL_CK_RC2_128_CBC_WITH_MD5)
ssl2_128Key.append(SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5)
ssl2_128Key.append(SSL_CK_IDEA_128_CBC_WITH_MD5)
#: SSL2 ciphersuites which use 64 bit key
ssl2_64Key = [SSL_CK_DES_64_CBC_WITH_MD5]
#: SSL2 ciphersuites which use 192 bit key
ssl2_192Key = [SSL_CK_DES_192_EDE3_CBC_WITH_MD5]
#
# SSLv3 and TLS cipher suite definitions
#
# RFC 5246 - TLS v1.2 Protocol
TLS_RSA_WITH_NULL_MD5 = 0x0001
ietfNames[0x0001] = 'TLS_RSA_WITH_NULL_MD5'
TLS_RSA_WITH_NULL_SHA = 0x0002
ietfNames[0x0002] = 'TLS_RSA_WITH_NULL_SHA'
TLS_RSA_WITH_RC4_128_MD5 = 0x0004
ietfNames[0x0004] = 'TLS_RSA_WITH_RC4_128_MD5'
TLS_RSA_WITH_RC4_128_SHA = 0x0005
ietfNames[0x0005] = 'TLS_RSA_WITH_RC4_128_SHA'
TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A
ietfNames[0x000A] = 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016
ietfNames[0x0016] = 'TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA'
TLS_DH_ANON_WITH_RC4_128_MD5 = 0x0018
ietfNames[0x0018] = 'TLS_DH_ANON_WITH_RC4_128_MD5'
TLS_DH_ANON_WITH_3DES_EDE_CBC_SHA = 0x001B
ietfNames[0x001B] = 'TLS_DH_ANON_WITH_3DES_EDE_CBC_SHA'
TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F
ietfNames[0x002F] = 'TLS_RSA_WITH_AES_128_CBC_SHA'
TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033
ietfNames[0x0033] = 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA'
TLS_DH_ANON_WITH_AES_128_CBC_SHA = 0x0034
ietfNames[0x0034] = 'TLS_DH_ANON_WITH_AES_128_CBC_SHA'
TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035
ietfNames[0x0035] = 'TLS_RSA_WITH_AES_256_CBC_SHA'
TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039
ietfNames[0x0039] = 'TLS_DHE_RSA_WITH_AES_256_CBC_SHA'
TLS_DH_ANON_WITH_AES_256_CBC_SHA = 0x003A
ietfNames[0x003A] = 'TLS_DH_ANON_WITH_AES_256_CBC_SHA'
TLS_RSA_WITH_NULL_SHA256 = 0x003B
ietfNames[0x003B] = 'TLS_RSA_WITH_NULL_SHA256'
TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003C
ietfNames[0x003C] = 'TLS_RSA_WITH_AES_128_CBC_SHA256'
TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003D
ietfNames[0x003D] = 'TLS_RSA_WITH_AES_256_CBC_SHA256'
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067
ietfNames[0x0067] = 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA256'
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006B
ietfNames[0x006B] = 'TLS_DHE_RSA_WITH_AES_256_CBC_SHA256'
TLS_DH_ANON_WITH_AES_128_CBC_SHA256 = 0x006C
ietfNames[0x006C] = 'TLS_DH_ANON_WITH_AES_128_CBC_SHA256'
TLS_DH_ANON_WITH_AES_256_CBC_SHA256 = 0x006D
ietfNames[0x006D] = 'TLS_DH_ANON_WITH_AES_256_CBC_SHA256'
# RFC 5288 - AES-GCM ciphers for TLSv1.2
TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009C
ietfNames[0x009C] = 'TLS_RSA_WITH_AES_128_GCM_SHA256'
TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009D
ietfNames[0x009D] = 'TLS_RSA_WITH_AES_256_GCM_SHA384'
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x009E
ietfNames[0x009E] = 'TLS_DHE_RSA_WITH_AES_128_GCM_SHA256'
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x009F
ietfNames[0x009F] = 'TLS_DHE_RSA_WITH_AES_256_GCM_SHA384'
TLS_DH_ANON_WITH_AES_128_GCM_SHA256 = 0x00A6
ietfNames[0x00A6] = 'TLS_DH_ANON_WITH_AES_128_GCM_SHA256'
TLS_DH_ANON_WITH_AES_256_GCM_SHA384 = 0x00A7
ietfNames[0x00A7] = 'TLS_DH_ANON_WITH_AES_256_GCM_SHA384'
# RFC 6655 - AES-CCM ciphers for TLSv1.2
TLS_RSA_WITH_AES_128_CCM = 0xC09C
ietfNames[0xC09C] = 'TLS_RSA_WITH_AES_128_CCM'
TLS_RSA_WITH_AES_256_CCM = 0xC09D
ietfNames[0xC09D] = 'TLS_RSA_WITH_AES_256_CCM'
TLS_DHE_RSA_WITH_AES_128_CCM = 0xC09E
ietfNames[0xC09E] = 'TLS_DHE_RSA_WITH_AES_128_CCM'
TLS_DHE_RSA_WITH_AES_256_CCM = 0xC09F
ietfNames[0xC09F] = 'TLS_DHE_RSA_WITH_AES_256_CCM'
TLS_RSA_WITH_AES_128_CCM_8 = 0xC0A0
ietfNames[0xC0A0] = 'TLS_RSA_WITH_AES_128_CCM_8'
TLS_RSA_WITH_AES_256_CCM_8 = 0xC0A1
ietfNames[0xC0A1] = 'TLS_RSA_WITH_AES_256_CCM_8'
TLS_DHE_RSA_WITH_AES_128_CCM_8 = 0xC0A2
ietfNames[0xC0A2] = 'TLS_DHE_RSA_WITH_AES_128_CCM_8'
TLS_DHE_RSA_WITH_AES_256_CCM_8 = 0xC0A3
ietfNames[0xC0A3] = 'TLS_DHE_RSA_WITH_AES_256_CCM_8'
# Weird pseudo-ciphersuite from RFC 5746
# Signals that "secure renegotiation" is supported
# We actually don't do any renegotiation, but this
# prevents renegotiation attacks
TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0x00FF
ietfNames[0x00FF] = 'TLS_EMPTY_RENEGOTIATION_INFO_SCSV'
# TLS 1.3 ciphersuites
TLS_AES_128_GCM_SHA256 = 0x1301
ietfNames[0x1301] = 'TLS_AES_128_GCM_SHA256'
TLS_AES_256_GCM_SHA384 = 0x1302
ietfNames[0x1302] = 'TLS_AES_256_GCM_SHA384'
TLS_CHACHA20_POLY1305_SHA256 = 0x1303
ietfNames[0x1303] = 'TLS_CHACHA20_POLY1305_SHA256'
TLS_AES_128_CCM_SHA256 = 0x1304
ietfNames[0x1304] = 'TLS_AES_128_CCM_SHA256'
TLS_AES_128_CCM_8_SHA256 = 0x1305
ietfNames[0x1305] = 'TLS_AES_128_CCM_8_SHA256'
# RFC 7507 - Fallback Signaling Cipher Suite Value for Preventing Protocol
# Downgrade Attacks
TLS_FALLBACK_SCSV = 0x5600
ietfNames[0x5600] = 'TLS_FALLBACK_SCSV'
# RFC 4492 - ECC Cipher Suites for TLS
# unsupported - no support for ECDSA certificates
TLS_ECDH_ECDSA_WITH_NULL_SHA = 0xC001
ietfNames[0xC001] = 'TLS_ECDH_ECDSA_WITH_NULL_SHA'
TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0xC002
ietfNames[0xC002] = 'TLS_ECDH_ECDSA_WITH_RC4_128_SHA'
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC003
ietfNames[0xC003] = 'TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA'
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0xC004
ietfNames[0xC004] = 'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA'
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005
ietfNames[0xC005] = 'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA'
TLS_ECDHE_ECDSA_WITH_NULL_SHA = 0xC006
ietfNames[0xC006] = 'TLS_ECDHE_ECDSA_WITH_NULL_SHA'
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0xC007
ietfNames[0xC007] = 'TLS_ECDHE_ECDSA_WITH_RC4_128_SHA'
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC008
ietfNames[0xC008] = 'TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA'
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009
ietfNames[0xC009] = 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA'
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A
ietfNames[0xC00A] = 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA'
TLS_ECDH_RSA_WITH_NULL_SHA = 0xC00B
ietfNames[0xC00B] = 'TLS_ECDH_RSA_WITH_NULL_SHA'
TLS_ECDH_RSA_WITH_RC4_128_SHA = 0xC00C
ietfNames[0xC00C] = 'TLS_ECDH_RSA_WITH_RC4_128_SHA'
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0xC00D
ietfNames[0xC00D] = 'TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA'
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0xC00E
ietfNames[0xC00E] = 'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA'
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0xC00F
ietfNames[0xC00F] = 'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA'
# RFC 4492 - ECC Cipher Suites for TLS
TLS_ECDHE_RSA_WITH_NULL_SHA = 0xC010
ietfNames[0xC010] = 'TLS_ECDHE_RSA_WITH_NULL_SHA'
TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0xC011
ietfNames[0xC011] = 'TLS_ECDHE_RSA_WITH_RC4_128_SHA'
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0xC012
ietfNames[0xC012] = 'TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA'
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013
ietfNames[0xC013] = 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA'
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014
ietfNames[0xC014] = 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA'
TLS_ECDH_ANON_WITH_NULL_SHA = 0xC015
ietfNames[0xC015] = 'TLS_ECDH_ANON_WITH_NULL_SHA'
TLS_ECDH_ANON_WITH_RC4_128_SHA = 0xC016
ietfNames[0xC016] = 'TLS_ECDH_ANON_WITH_RC4_128_SHA'
TLS_ECDH_ANON_WITH_3DES_EDE_CBC_SHA = 0xC017
ietfNames[0xC017] = 'TLS_ECDH_ANON_WITH_3DES_EDE_CBC_SHA'
TLS_ECDH_ANON_WITH_AES_128_CBC_SHA = 0xC018
ietfNames[0xC018] = 'TLS_ECDH_ANON_WITH_AES_128_CBC_SHA'
TLS_ECDH_ANON_WITH_AES_256_CBC_SHA = 0xC019
ietfNames[0xC019] = 'TLS_ECDH_ANON_WITH_AES_256_CBC_SHA'
# RFC 5054 - Secure Remote Password (SRP) Protocol for TLS Authentication
TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA = 0xC01A
ietfNames[0xC01A] = 'TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA'
TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA = 0xC01B
ietfNames[0xC01B] = 'TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA'
TLS_SRP_SHA_WITH_AES_128_CBC_SHA = 0xC01D
ietfNames[0xC01D] = 'TLS_SRP_SHA_WITH_AES_128_CBC_SHA'
TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA = 0xC01E
ietfNames[0xC01E] = 'TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA'
TLS_SRP_SHA_WITH_AES_256_CBC_SHA = 0xC020
ietfNames[0xC020] = 'TLS_SRP_SHA_WITH_AES_256_CBC_SHA'
TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA = 0xC021
ietfNames[0xC021] = 'TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA'
# RFC 5289 - ECC Ciphers with SHA-256/SHA-384 HMAC and AES-GCM
# unsupported! - no support for ECDSA certificates
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023
ietfNames[0xC023] = 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256'
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024
ietfNames[0xC024] = 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384'
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC025
ietfNames[0xC025] = 'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256'
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC026
ietfNames[0xC026] = 'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384'
# RFC 5289 - ECC Ciphers with SHA-256/SHA-384 HMAC and AES-GCM
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027
ietfNames[0xC027] = 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028
ietfNames[0xC028] = 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384'
# RFC 5289 - ECC Ciphers with SHA-256/SHA-384 HMAC and AES-GCM
# unsupported
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0xC029
ietfNames[0xC029] = 'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256'
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0xC02A
ietfNames[0xC02A] = 'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384'
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B
ietfNames[0xC02B] = 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256'
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02C
ietfNames[0xC02C] = 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384'
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02D
ietfNames[0xC02D] = 'TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256'
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02E
ietfNames[0xC02E] = 'TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384'
# RFC 5289 - ECC Ciphers with SHA-256/SHA-384 HMAC and AES-GCM
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F
ietfNames[0xC02F] = 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256'
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xC030
ietfNames[0xC030] = 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'
# RFC 5289 - ECC Ciphers with SHA-256/SHA-384 HMAC and AES-GCM
# unsupported
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = 0xC031
ietfNames[0xC031] = 'TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256'
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0xC032
ietfNames[0xC032] = 'TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384'
# draft-ietf-tls-chacha20-poly1305-00
# ChaCha20/Poly1305 based Cipher Suites for TLS1.2
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_draft_00 = 0xCCA1
ietfNames[0xCCA1] = 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_draft_00'
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_draft_00 = 0xCCA2
ietfNames[0xCCA2] = 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_draft_00'
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_draft_00 = 0xCCA3
ietfNames[0xCCA3] = 'TLS_DHE_RSA_WITH_CHACHA20_POLY1305_draft_00'
# RFC 7905 - ChaCha20-Poly1305 Cipher Suites for TLS
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA8
ietfNames[0xCCA8] = 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256'
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA9
ietfNames[0xCCA9] = 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256'
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCAA
ietfNames[0xCCAA] = 'TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256'
# RFC 7251 - AES-CCM ECC Ciphers for TLS
TLS_ECDHE_ECDSA_WITH_AES_128_CCM = 0xC0AC
ietfNames[0xC0AC] = 'TLS_ECDHE_ECDSA_WITH_AES_128_CCM'
TLS_ECDHE_ECDSA_WITH_AES_256_CCM = 0xC0AD
ietfNames[0xC0AD] = 'TLS_ECDHE_ECDSA_WITH_AES_256_CCM'
TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 = 0xC0AE
ietfNames[0xC0AE] = 'TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8'
TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 = 0xC0AF
ietfNames[0xC0AF] = 'TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8'
#pylint: enable = invalid-name
#
# Define cipher suite families below
#
#: 3DES CBC ciphers
tripleDESSuites = []
tripleDESSuites.append(TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA) # unsupported
tripleDESSuites.append(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA) # unsupported
tripleDESSuites.append(TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_RSA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_DH_ANON_WITH_3DES_EDE_CBC_SHA)
tripleDESSuites.append(TLS_ECDH_ANON_WITH_3DES_EDE_CBC_SHA)
#: AES-128 CBC ciphers
aes128Suites = []
aes128Suites.append(TLS_SRP_SHA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_RSA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_DHE_RSA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_DH_ANON_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_RSA_WITH_AES_128_CBC_SHA256)
aes128Suites.append(TLS_DHE_RSA_WITH_AES_128_CBC_SHA256)
aes128Suites.append(TLS_DH_ANON_WITH_AES_128_CBC_SHA256)
aes128Suites.append(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256)
aes128Suites.append(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256) # unsupported
aes128Suites.append(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA) # unsupported
aes128Suites.append(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256) # unsupported
aes128Suites.append(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA) # unsupported
aes128Suites.append(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA)
aes128Suites.append(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256)
aes128Suites.append(TLS_ECDH_ANON_WITH_AES_128_CBC_SHA)
#: AES-256 CBC ciphers
aes256Suites = []
aes256Suites.append(TLS_SRP_SHA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_RSA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_DH_ANON_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_DHE_RSA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_RSA_WITH_AES_256_CBC_SHA256)
aes256Suites.append(TLS_DHE_RSA_WITH_AES_256_CBC_SHA256)
aes256Suites.append(TLS_DH_ANON_WITH_AES_256_CBC_SHA256)
aes256Suites.append(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384)
aes256Suites.append(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384) # unsupported
aes256Suites.append(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA) # unsupported
aes256Suites.append(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384) # unsupported
aes256Suites.append(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA) # unsupported
aes256Suites.append(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA)
aes256Suites.append(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384)
aes256Suites.append(TLS_ECDH_ANON_WITH_AES_256_CBC_SHA)
#: AES-128 GCM ciphers
aes128GcmSuites = []
aes128GcmSuites.append(TLS_RSA_WITH_AES_128_GCM_SHA256)
aes128GcmSuites.append(TLS_DHE_RSA_WITH_AES_128_GCM_SHA256)
aes128GcmSuites.append(TLS_DH_ANON_WITH_AES_128_GCM_SHA256)
aes128GcmSuites.append(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)
aes128GcmSuites.append(TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256) # unsupp
aes128GcmSuites.append(TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256) # unsupp
aes128GcmSuites.append(TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
aes128GcmSuites.append(TLS_AES_128_GCM_SHA256)
#: AES-256-GCM ciphers (implicit SHA384, see sha384PrfSuites)
aes256GcmSuites = []
aes256GcmSuites.append(TLS_RSA_WITH_AES_256_GCM_SHA384)
aes256GcmSuites.append(TLS_DHE_RSA_WITH_AES_256_GCM_SHA384)
aes256GcmSuites.append(TLS_DH_ANON_WITH_AES_256_GCM_SHA384)
aes256GcmSuites.append(TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384)
aes256GcmSuites.append(TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384) # unsupp
aes256GcmSuites.append(TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384) # unsupported
aes256GcmSuites.append(TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384)
aes256GcmSuites.append(TLS_AES_256_GCM_SHA384)
#: AES-128 CCM_8 ciphers
aes128Ccm_8Suites = []
aes128Ccm_8Suites.append(TLS_RSA_WITH_AES_128_CCM_8)
aes128Ccm_8Suites.append(TLS_DHE_RSA_WITH_AES_128_CCM_8)
aes128Ccm_8Suites.append(TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8)
aes128Ccm_8Suites.append(TLS_AES_128_CCM_8_SHA256)
#: AES-128 CCM ciphers
aes128CcmSuites = []
aes128CcmSuites.append(TLS_RSA_WITH_AES_128_CCM)
aes128CcmSuites.append(TLS_DHE_RSA_WITH_AES_128_CCM)
aes128CcmSuites.append(TLS_ECDHE_ECDSA_WITH_AES_128_CCM)
aes128CcmSuites.append(TLS_AES_128_CCM_SHA256)
#: AES-256 CCM_8 ciphers
aes256Ccm_8Suites = []
aes256Ccm_8Suites.append(TLS_RSA_WITH_AES_256_CCM_8)
aes256Ccm_8Suites.append(TLS_DHE_RSA_WITH_AES_256_CCM_8)
aes256Ccm_8Suites.append(TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8)
# AES-256 CCM ciphers
aes256CcmSuites = []
aes256CcmSuites.append(TLS_RSA_WITH_AES_256_CCM)
aes256CcmSuites.append(TLS_DHE_RSA_WITH_AES_256_CCM)
aes256CcmSuites.append(TLS_ECDHE_ECDSA_WITH_AES_256_CCM)
#: CHACHA20 cipher, 00'th IETF draft (implicit POLY1305 authenticator)
chacha20draft00Suites = []
chacha20draft00Suites.append(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_draft_00)
chacha20draft00Suites.append(
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_draft_00)
chacha20draft00Suites.append(TLS_DHE_RSA_WITH_CHACHA20_POLY1305_draft_00)
#: CHACHA20 cipher (implicit POLY1305 authenticator, SHA256 PRF)
chacha20Suites = []
chacha20Suites.append(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256)
chacha20Suites.append(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256)
chacha20Suites.append(TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256)
chacha20Suites.append(TLS_CHACHA20_POLY1305_SHA256)
#: RC4 128 stream cipher
rc4Suites = []
rc4Suites.append(TLS_ECDHE_RSA_WITH_RC4_128_SHA)
rc4Suites.append(TLS_ECDHE_ECDSA_WITH_RC4_128_SHA)
rc4Suites.append(TLS_ECDH_ECDSA_WITH_RC4_128_SHA) # unsupported
rc4Suites.append(TLS_ECDH_RSA_WITH_RC4_128_SHA) # unsupported
rc4Suites.append(TLS_DH_ANON_WITH_RC4_128_MD5)
rc4Suites.append(TLS_RSA_WITH_RC4_128_SHA)
rc4Suites.append(TLS_RSA_WITH_RC4_128_MD5)
rc4Suites.append(TLS_ECDH_ANON_WITH_RC4_128_SHA)
#: no encryption
nullSuites = []
nullSuites.append(TLS_RSA_WITH_NULL_MD5)
nullSuites.append(TLS_RSA_WITH_NULL_SHA)
nullSuites.append(TLS_RSA_WITH_NULL_SHA256)
nullSuites.append(TLS_ECDHE_ECDSA_WITH_NULL_SHA)
nullSuites.append(TLS_ECDH_ECDSA_WITH_NULL_SHA) # unsupported
nullSuites.append(TLS_ECDH_RSA_WITH_NULL_SHA) # unsupported
nullSuites.append(TLS_ECDHE_RSA_WITH_NULL_SHA)
nullSuites.append(TLS_ECDH_ANON_WITH_NULL_SHA)
#: SHA-1 HMAC, protocol default PRF
shaSuites = []
shaSuites.append(TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA)
shaSuites.append(TLS_SRP_SHA_WITH_AES_128_CBC_SHA)
shaSuites.append(TLS_SRP_SHA_WITH_AES_256_CBC_SHA)
shaSuites.append(TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA)
shaSuites.append(TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA)
shaSuites.append(TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA)
shaSuites.append(TLS_RSA_WITH_3DES_EDE_CBC_SHA)
shaSuites.append(TLS_RSA_WITH_AES_128_CBC_SHA)
shaSuites.append(TLS_RSA_WITH_AES_256_CBC_SHA)
shaSuites.append(TLS_RSA_WITH_RC4_128_SHA)