Module: TTTLS13::CipherSuite
- Defined in:
- lib/tttls1.3/cipher_suites.rb
Constant Summary collapse
- TLS_AES_128_GCM_SHA256 =
"\x13\x01"
- TLS_AES_256_GCM_SHA384 =
"\x13\x02"
- TLS_CHACHA20_POLY1305_SHA256 =
"\x13\x03"
Class Method Summary collapse
- .auth_tag_len(cipher_suite) ⇒ Object
- .digest(cipher_suite) ⇒ Object
- .hash_len(cipher_suite) ⇒ Object
- .iv_len(cipher_suite) ⇒ Object
- .key_len(cipher_suite) ⇒ Object
Class Method Details
.auth_tag_len(cipher_suite) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/tttls1.3/cipher_suites.rb', line 61 def auth_tag_len(cipher_suite) case cipher_suite when TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256 # , TLS_AES_128_CCM_SHA256 16 # when TLS_AES_128_CCM_8_SHA256 # 8 else raise Error::ErrorAlerts, :internal_error end end |
.digest(cipher_suite) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tttls1.3/cipher_suites.rb', line 14 def digest(cipher_suite) case cipher_suite when TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256 # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256 'SHA256' when TLS_AES_256_GCM_SHA384 'SHA384' else raise Error::ErrorAlerts, :internal_error end end |
.hash_len(cipher_suite) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tttls1.3/cipher_suites.rb', line 26 def hash_len(cipher_suite) case cipher_suite when TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256 # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256 32 when TLS_AES_256_GCM_SHA384 48 else raise Error::ErrorAlerts, :internal_error end end |
.iv_len(cipher_suite) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/tttls1.3/cipher_suites.rb', line 50 def iv_len(cipher_suite) case cipher_suite when TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256 # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256 12 else raise Error::ErrorAlerts, :internal_error end end |
.key_len(cipher_suite) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/tttls1.3/cipher_suites.rb', line 38 def key_len(cipher_suite) case cipher_suite when TLS_AES_128_GCM_SHA256 # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256 16 when TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256 32 else raise Error::ErrorAlerts, :internal_error end end |