Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bindings.py 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. """
  2. This module uses ctypes to bind a whole bunch of functions and constants from
  3. SecureTransport. The goal here is to provide the low-level API to
  4. SecureTransport. These are essentially the C-level functions and constants, and
  5. they're pretty gross to work with.
  6. This code is a bastardised version of the code found in Will Bond's oscrypto
  7. library. An enormous debt is owed to him for blazing this trail for us. For
  8. that reason, this code should be considered to be covered both by urllib3's
  9. license and by oscrypto's:
  10. Copyright (c) 2015-2016 Will Bond <will@wbond.net>
  11. Permission is hereby granted, free of charge, to any person obtaining a
  12. copy of this software and associated documentation files (the "Software"),
  13. to deal in the Software without restriction, including without limitation
  14. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  15. and/or sell copies of the Software, and to permit persons to whom the
  16. Software is furnished to do so, subject to the following conditions:
  17. The above copyright notice and this permission notice shall be included in
  18. all copies or substantial portions of the Software.
  19. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  24. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  25. DEALINGS IN THE SOFTWARE.
  26. """
  27. from __future__ import absolute_import
  28. import platform
  29. from ctypes.util import find_library
  30. from ctypes import (
  31. c_void_p, c_int32, c_char_p, c_size_t, c_byte, c_uint32, c_ulong, c_long,
  32. c_bool
  33. )
  34. from ctypes import CDLL, POINTER, CFUNCTYPE
  35. security_path = find_library('Security')
  36. if not security_path:
  37. raise ImportError('The library Security could not be found')
  38. core_foundation_path = find_library('CoreFoundation')
  39. if not core_foundation_path:
  40. raise ImportError('The library CoreFoundation could not be found')
  41. version = platform.mac_ver()[0]
  42. version_info = tuple(map(int, version.split('.')))
  43. if version_info < (10, 8):
  44. raise OSError(
  45. 'Only OS X 10.8 and newer are supported, not %s.%s' % (
  46. version_info[0], version_info[1]
  47. )
  48. )
  49. Security = CDLL(security_path, use_errno=True)
  50. CoreFoundation = CDLL(core_foundation_path, use_errno=True)
  51. Boolean = c_bool
  52. CFIndex = c_long
  53. CFStringEncoding = c_uint32
  54. CFData = c_void_p
  55. CFString = c_void_p
  56. CFArray = c_void_p
  57. CFMutableArray = c_void_p
  58. CFDictionary = c_void_p
  59. CFError = c_void_p
  60. CFType = c_void_p
  61. CFTypeID = c_ulong
  62. CFTypeRef = POINTER(CFType)
  63. CFAllocatorRef = c_void_p
  64. OSStatus = c_int32
  65. CFDataRef = POINTER(CFData)
  66. CFStringRef = POINTER(CFString)
  67. CFArrayRef = POINTER(CFArray)
  68. CFMutableArrayRef = POINTER(CFMutableArray)
  69. CFDictionaryRef = POINTER(CFDictionary)
  70. CFArrayCallBacks = c_void_p
  71. CFDictionaryKeyCallBacks = c_void_p
  72. CFDictionaryValueCallBacks = c_void_p
  73. SecCertificateRef = POINTER(c_void_p)
  74. SecExternalFormat = c_uint32
  75. SecExternalItemType = c_uint32
  76. SecIdentityRef = POINTER(c_void_p)
  77. SecItemImportExportFlags = c_uint32
  78. SecItemImportExportKeyParameters = c_void_p
  79. SecKeychainRef = POINTER(c_void_p)
  80. SSLProtocol = c_uint32
  81. SSLCipherSuite = c_uint32
  82. SSLContextRef = POINTER(c_void_p)
  83. SecTrustRef = POINTER(c_void_p)
  84. SSLConnectionRef = c_uint32
  85. SecTrustResultType = c_uint32
  86. SecTrustOptionFlags = c_uint32
  87. SSLProtocolSide = c_uint32
  88. SSLConnectionType = c_uint32
  89. SSLSessionOption = c_uint32
  90. try:
  91. Security.SecItemImport.argtypes = [
  92. CFDataRef,
  93. CFStringRef,
  94. POINTER(SecExternalFormat),
  95. POINTER(SecExternalItemType),
  96. SecItemImportExportFlags,
  97. POINTER(SecItemImportExportKeyParameters),
  98. SecKeychainRef,
  99. POINTER(CFArrayRef),
  100. ]
  101. Security.SecItemImport.restype = OSStatus
  102. Security.SecCertificateGetTypeID.argtypes = []
  103. Security.SecCertificateGetTypeID.restype = CFTypeID
  104. Security.SecIdentityGetTypeID.argtypes = []
  105. Security.SecIdentityGetTypeID.restype = CFTypeID
  106. Security.SecKeyGetTypeID.argtypes = []
  107. Security.SecKeyGetTypeID.restype = CFTypeID
  108. Security.SecCertificateCreateWithData.argtypes = [
  109. CFAllocatorRef,
  110. CFDataRef
  111. ]
  112. Security.SecCertificateCreateWithData.restype = SecCertificateRef
  113. Security.SecCertificateCopyData.argtypes = [
  114. SecCertificateRef
  115. ]
  116. Security.SecCertificateCopyData.restype = CFDataRef
  117. Security.SecCopyErrorMessageString.argtypes = [
  118. OSStatus,
  119. c_void_p
  120. ]
  121. Security.SecCopyErrorMessageString.restype = CFStringRef
  122. Security.SecIdentityCreateWithCertificate.argtypes = [
  123. CFTypeRef,
  124. SecCertificateRef,
  125. POINTER(SecIdentityRef)
  126. ]
  127. Security.SecIdentityCreateWithCertificate.restype = OSStatus
  128. Security.SecKeychainCreate.argtypes = [
  129. c_char_p,
  130. c_uint32,
  131. c_void_p,
  132. Boolean,
  133. c_void_p,
  134. POINTER(SecKeychainRef)
  135. ]
  136. Security.SecKeychainCreate.restype = OSStatus
  137. Security.SecKeychainDelete.argtypes = [
  138. SecKeychainRef
  139. ]
  140. Security.SecKeychainDelete.restype = OSStatus
  141. Security.SecPKCS12Import.argtypes = [
  142. CFDataRef,
  143. CFDictionaryRef,
  144. POINTER(CFArrayRef)
  145. ]
  146. Security.SecPKCS12Import.restype = OSStatus
  147. SSLReadFunc = CFUNCTYPE(OSStatus, SSLConnectionRef, c_void_p, POINTER(c_size_t))
  148. SSLWriteFunc = CFUNCTYPE(OSStatus, SSLConnectionRef, POINTER(c_byte), POINTER(c_size_t))
  149. Security.SSLSetIOFuncs.argtypes = [
  150. SSLContextRef,
  151. SSLReadFunc,
  152. SSLWriteFunc
  153. ]
  154. Security.SSLSetIOFuncs.restype = OSStatus
  155. Security.SSLSetPeerID.argtypes = [
  156. SSLContextRef,
  157. c_char_p,
  158. c_size_t
  159. ]
  160. Security.SSLSetPeerID.restype = OSStatus
  161. Security.SSLSetCertificate.argtypes = [
  162. SSLContextRef,
  163. CFArrayRef
  164. ]
  165. Security.SSLSetCertificate.restype = OSStatus
  166. Security.SSLSetCertificateAuthorities.argtypes = [
  167. SSLContextRef,
  168. CFTypeRef,
  169. Boolean
  170. ]
  171. Security.SSLSetCertificateAuthorities.restype = OSStatus
  172. Security.SSLSetConnection.argtypes = [
  173. SSLContextRef,
  174. SSLConnectionRef
  175. ]
  176. Security.SSLSetConnection.restype = OSStatus
  177. Security.SSLSetPeerDomainName.argtypes = [
  178. SSLContextRef,
  179. c_char_p,
  180. c_size_t
  181. ]
  182. Security.SSLSetPeerDomainName.restype = OSStatus
  183. Security.SSLHandshake.argtypes = [
  184. SSLContextRef
  185. ]
  186. Security.SSLHandshake.restype = OSStatus
  187. Security.SSLRead.argtypes = [
  188. SSLContextRef,
  189. c_char_p,
  190. c_size_t,
  191. POINTER(c_size_t)
  192. ]
  193. Security.SSLRead.restype = OSStatus
  194. Security.SSLWrite.argtypes = [
  195. SSLContextRef,
  196. c_char_p,
  197. c_size_t,
  198. POINTER(c_size_t)
  199. ]
  200. Security.SSLWrite.restype = OSStatus
  201. Security.SSLClose.argtypes = [
  202. SSLContextRef
  203. ]
  204. Security.SSLClose.restype = OSStatus
  205. Security.SSLGetNumberSupportedCiphers.argtypes = [
  206. SSLContextRef,
  207. POINTER(c_size_t)
  208. ]
  209. Security.SSLGetNumberSupportedCiphers.restype = OSStatus
  210. Security.SSLGetSupportedCiphers.argtypes = [
  211. SSLContextRef,
  212. POINTER(SSLCipherSuite),
  213. POINTER(c_size_t)
  214. ]
  215. Security.SSLGetSupportedCiphers.restype = OSStatus
  216. Security.SSLSetEnabledCiphers.argtypes = [
  217. SSLContextRef,
  218. POINTER(SSLCipherSuite),
  219. c_size_t
  220. ]
  221. Security.SSLSetEnabledCiphers.restype = OSStatus
  222. Security.SSLGetNumberEnabledCiphers.argtype = [
  223. SSLContextRef,
  224. POINTER(c_size_t)
  225. ]
  226. Security.SSLGetNumberEnabledCiphers.restype = OSStatus
  227. Security.SSLGetEnabledCiphers.argtypes = [
  228. SSLContextRef,
  229. POINTER(SSLCipherSuite),
  230. POINTER(c_size_t)
  231. ]
  232. Security.SSLGetEnabledCiphers.restype = OSStatus
  233. Security.SSLGetNegotiatedCipher.argtypes = [
  234. SSLContextRef,
  235. POINTER(SSLCipherSuite)
  236. ]
  237. Security.SSLGetNegotiatedCipher.restype = OSStatus
  238. Security.SSLGetNegotiatedProtocolVersion.argtypes = [
  239. SSLContextRef,
  240. POINTER(SSLProtocol)
  241. ]
  242. Security.SSLGetNegotiatedProtocolVersion.restype = OSStatus
  243. Security.SSLCopyPeerTrust.argtypes = [
  244. SSLContextRef,
  245. POINTER(SecTrustRef)
  246. ]
  247. Security.SSLCopyPeerTrust.restype = OSStatus
  248. Security.SecTrustSetAnchorCertificates.argtypes = [
  249. SecTrustRef,
  250. CFArrayRef
  251. ]
  252. Security.SecTrustSetAnchorCertificates.restype = OSStatus
  253. Security.SecTrustSetAnchorCertificatesOnly.argstypes = [
  254. SecTrustRef,
  255. Boolean
  256. ]
  257. Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus
  258. Security.SecTrustEvaluate.argtypes = [
  259. SecTrustRef,
  260. POINTER(SecTrustResultType)
  261. ]
  262. Security.SecTrustEvaluate.restype = OSStatus
  263. Security.SecTrustGetCertificateCount.argtypes = [
  264. SecTrustRef
  265. ]
  266. Security.SecTrustGetCertificateCount.restype = CFIndex
  267. Security.SecTrustGetCertificateAtIndex.argtypes = [
  268. SecTrustRef,
  269. CFIndex
  270. ]
  271. Security.SecTrustGetCertificateAtIndex.restype = SecCertificateRef
  272. Security.SSLCreateContext.argtypes = [
  273. CFAllocatorRef,
  274. SSLProtocolSide,
  275. SSLConnectionType
  276. ]
  277. Security.SSLCreateContext.restype = SSLContextRef
  278. Security.SSLSetSessionOption.argtypes = [
  279. SSLContextRef,
  280. SSLSessionOption,
  281. Boolean
  282. ]
  283. Security.SSLSetSessionOption.restype = OSStatus
  284. Security.SSLSetProtocolVersionMin.argtypes = [
  285. SSLContextRef,
  286. SSLProtocol
  287. ]
  288. Security.SSLSetProtocolVersionMin.restype = OSStatus
  289. Security.SSLSetProtocolVersionMax.argtypes = [
  290. SSLContextRef,
  291. SSLProtocol
  292. ]
  293. Security.SSLSetProtocolVersionMax.restype = OSStatus
  294. Security.SecCopyErrorMessageString.argtypes = [
  295. OSStatus,
  296. c_void_p
  297. ]
  298. Security.SecCopyErrorMessageString.restype = CFStringRef
  299. Security.SSLReadFunc = SSLReadFunc
  300. Security.SSLWriteFunc = SSLWriteFunc
  301. Security.SSLContextRef = SSLContextRef
  302. Security.SSLProtocol = SSLProtocol
  303. Security.SSLCipherSuite = SSLCipherSuite
  304. Security.SecIdentityRef = SecIdentityRef
  305. Security.SecKeychainRef = SecKeychainRef
  306. Security.SecTrustRef = SecTrustRef
  307. Security.SecTrustResultType = SecTrustResultType
  308. Security.SecExternalFormat = SecExternalFormat
  309. Security.OSStatus = OSStatus
  310. Security.kSecImportExportPassphrase = CFStringRef.in_dll(
  311. Security, 'kSecImportExportPassphrase'
  312. )
  313. Security.kSecImportItemIdentity = CFStringRef.in_dll(
  314. Security, 'kSecImportItemIdentity'
  315. )
  316. # CoreFoundation time!
  317. CoreFoundation.CFRetain.argtypes = [
  318. CFTypeRef
  319. ]
  320. CoreFoundation.CFRetain.restype = CFTypeRef
  321. CoreFoundation.CFRelease.argtypes = [
  322. CFTypeRef
  323. ]
  324. CoreFoundation.CFRelease.restype = None
  325. CoreFoundation.CFGetTypeID.argtypes = [
  326. CFTypeRef
  327. ]
  328. CoreFoundation.CFGetTypeID.restype = CFTypeID
  329. CoreFoundation.CFStringCreateWithCString.argtypes = [
  330. CFAllocatorRef,
  331. c_char_p,
  332. CFStringEncoding
  333. ]
  334. CoreFoundation.CFStringCreateWithCString.restype = CFStringRef
  335. CoreFoundation.CFStringGetCStringPtr.argtypes = [
  336. CFStringRef,
  337. CFStringEncoding
  338. ]
  339. CoreFoundation.CFStringGetCStringPtr.restype = c_char_p
  340. CoreFoundation.CFStringGetCString.argtypes = [
  341. CFStringRef,
  342. c_char_p,
  343. CFIndex,
  344. CFStringEncoding
  345. ]
  346. CoreFoundation.CFStringGetCString.restype = c_bool
  347. CoreFoundation.CFDataCreate.argtypes = [
  348. CFAllocatorRef,
  349. c_char_p,
  350. CFIndex
  351. ]
  352. CoreFoundation.CFDataCreate.restype = CFDataRef
  353. CoreFoundation.CFDataGetLength.argtypes = [
  354. CFDataRef
  355. ]
  356. CoreFoundation.CFDataGetLength.restype = CFIndex
  357. CoreFoundation.CFDataGetBytePtr.argtypes = [
  358. CFDataRef
  359. ]
  360. CoreFoundation.CFDataGetBytePtr.restype = c_void_p
  361. CoreFoundation.CFDictionaryCreate.argtypes = [
  362. CFAllocatorRef,
  363. POINTER(CFTypeRef),
  364. POINTER(CFTypeRef),
  365. CFIndex,
  366. CFDictionaryKeyCallBacks,
  367. CFDictionaryValueCallBacks
  368. ]
  369. CoreFoundation.CFDictionaryCreate.restype = CFDictionaryRef
  370. CoreFoundation.CFDictionaryGetValue.argtypes = [
  371. CFDictionaryRef,
  372. CFTypeRef
  373. ]
  374. CoreFoundation.CFDictionaryGetValue.restype = CFTypeRef
  375. CoreFoundation.CFArrayCreate.argtypes = [
  376. CFAllocatorRef,
  377. POINTER(CFTypeRef),
  378. CFIndex,
  379. CFArrayCallBacks,
  380. ]
  381. CoreFoundation.CFArrayCreate.restype = CFArrayRef
  382. CoreFoundation.CFArrayCreateMutable.argtypes = [
  383. CFAllocatorRef,
  384. CFIndex,
  385. CFArrayCallBacks
  386. ]
  387. CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef
  388. CoreFoundation.CFArrayAppendValue.argtypes = [
  389. CFMutableArrayRef,
  390. c_void_p
  391. ]
  392. CoreFoundation.CFArrayAppendValue.restype = None
  393. CoreFoundation.CFArrayGetCount.argtypes = [
  394. CFArrayRef
  395. ]
  396. CoreFoundation.CFArrayGetCount.restype = CFIndex
  397. CoreFoundation.CFArrayGetValueAtIndex.argtypes = [
  398. CFArrayRef,
  399. CFIndex
  400. ]
  401. CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p
  402. CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll(
  403. CoreFoundation, 'kCFAllocatorDefault'
  404. )
  405. CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll(CoreFoundation, 'kCFTypeArrayCallBacks')
  406. CoreFoundation.kCFTypeDictionaryKeyCallBacks = c_void_p.in_dll(
  407. CoreFoundation, 'kCFTypeDictionaryKeyCallBacks'
  408. )
  409. CoreFoundation.kCFTypeDictionaryValueCallBacks = c_void_p.in_dll(
  410. CoreFoundation, 'kCFTypeDictionaryValueCallBacks'
  411. )
  412. CoreFoundation.CFTypeRef = CFTypeRef
  413. CoreFoundation.CFArrayRef = CFArrayRef
  414. CoreFoundation.CFStringRef = CFStringRef
  415. CoreFoundation.CFDictionaryRef = CFDictionaryRef
  416. except (AttributeError):
  417. raise ImportError('Error initializing ctypes')
  418. class CFConst(object):
  419. """
  420. A class object that acts as essentially a namespace for CoreFoundation
  421. constants.
  422. """
  423. kCFStringEncodingUTF8 = CFStringEncoding(0x08000100)
  424. class SecurityConst(object):
  425. """
  426. A class object that acts as essentially a namespace for Security constants.
  427. """
  428. kSSLSessionOptionBreakOnServerAuth = 0
  429. kSSLProtocol2 = 1
  430. kSSLProtocol3 = 2
  431. kTLSProtocol1 = 4
  432. kTLSProtocol11 = 7
  433. kTLSProtocol12 = 8
  434. kSSLClientSide = 1
  435. kSSLStreamType = 0
  436. kSecFormatPEMSequence = 10
  437. kSecTrustResultInvalid = 0
  438. kSecTrustResultProceed = 1
  439. # This gap is present on purpose: this was kSecTrustResultConfirm, which
  440. # is deprecated.
  441. kSecTrustResultDeny = 3
  442. kSecTrustResultUnspecified = 4
  443. kSecTrustResultRecoverableTrustFailure = 5
  444. kSecTrustResultFatalTrustFailure = 6
  445. kSecTrustResultOtherError = 7
  446. errSSLProtocol = -9800
  447. errSSLWouldBlock = -9803
  448. errSSLClosedGraceful = -9805
  449. errSSLClosedNoNotify = -9816
  450. errSSLClosedAbort = -9806
  451. errSSLXCertChainInvalid = -9807
  452. errSSLCrypto = -9809
  453. errSSLInternal = -9810
  454. errSSLCertExpired = -9814
  455. errSSLCertNotYetValid = -9815
  456. errSSLUnknownRootCert = -9812
  457. errSSLNoRootCert = -9813
  458. errSSLHostNameMismatch = -9843
  459. errSSLPeerHandshakeFail = -9824
  460. errSSLPeerUserCancelled = -9839
  461. errSSLWeakPeerEphemeralDHKey = -9850
  462. errSSLServerAuthCompleted = -9841
  463. errSSLRecordOverflow = -9847
  464. errSecVerifyFailed = -67808
  465. errSecNoTrustSettings = -25263
  466. errSecItemNotFound = -25300
  467. errSecInvalidTrustSettings = -25262
  468. # Cipher suites. We only pick the ones our default cipher string allows.
  469. TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02C
  470. TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xC030
  471. TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B
  472. TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F
  473. TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 = 0x00A3
  474. TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x009F
  475. TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 = 0x00A2
  476. TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x009E
  477. TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024
  478. TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028
  479. TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A
  480. TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014
  481. TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006B
  482. TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x006A
  483. TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039
  484. TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x0038
  485. TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023
  486. TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027
  487. TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009
  488. TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013
  489. TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067
  490. TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x0040
  491. TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033
  492. TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032
  493. TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009D
  494. TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009C
  495. TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003D
  496. TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003C
  497. TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035
  498. TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F
  499. TLS_AES_128_GCM_SHA256 = 0x1301
  500. TLS_AES_256_GCM_SHA384 = 0x1302
  501. TLS_CHACHA20_POLY1305_SHA256 = 0x1303