Fields

class flextls.field.CertificateField(name='certificate')[source]

A certificate.

Parameters:name (String) – The name of the field
class flextls.field.CertificateListField(name)[source]

List of certificates

Parameters:name (String) – The name of the field
class flextls.field.CipherSuiteField(name='unnamed')[source]

A cipher suite

class flextls.field.CipherSuitesField(name)[source]

List of cipher suites.

Parameters:name (String) – The name of the field
class flextls.field.CompressionMethodField(name='unnamed')[source]

Compression method

class flextls.field.CompressionMethodsField(name)[source]

List of compression methods

Parameters:name (String) – The name of the field
class flextls.field.ECParametersNamedCurveField(name)[source]

RFC4492 ECC Cipher Suites for TLS

class flextls.field.ECPointField(name)[source]

RFC4492 ECC Cipher Suites for TLS

class flextls.field.EnumField(name, default, enums, fmt='H')[source]

The field should only use the defined values.

Parameters:
  • name (String) – The name of the field
  • default (Mixed) – A value defined in the enums list
  • enums (Dict) – List of possible values.
  • fmt (String) – The format string
get_value_name(pretty=False)[source]

Get the name of the value

Parameters:pretty (Boolean) – Return the name in a pretty format
Returns:The name
Return type:String
set_value(value, force=False)[source]

Set the value.

Parameters:
  • value (String|Integer) – The value to set. Must be in the enum list.
  • force (Boolean) – Set the value without checking it
Raises:
  • ValueError – If value name given but it isn’t available
  • TypeError – If value is not String or Integer
value

Return the field value.

Returns:The value of the field
Return type:Mixed
class flextls.field.ExtensionsField(name)[source]

List of extensions

Parameters:name (String) – The name of the field
class flextls.field.Field(name, default, fmt='H')[source]

Base class for all fields. Used to extract additional information.

Parameters:
  • name (String) – Name of the field
  • default (Mixed) – Default field value
  • fmt (String) – Format string used to decode the data
assemble()[source]

Assemble the field by using the given value.

Returns:The assembled data
Return type:bytes
dissect(data)[source]

Dissect the field.

Parameters:data (bytes) – The data to extract the field value from
Returns:The rest of the data not used to dissect the field value
Return type:bytes
get_value()[source]

Return the field value.

Returns:The value of the field
Return type:Mixed
set_value(value)[source]

Set the value of the field

Parameters:value (Mixed) – The value
value

Return the field value.

Returns:The value of the field
Return type:Mixed
class flextls.field.HostNameField(name)[source]

The hostname.

class flextls.field.MultiPartField(name, fields=[])[source]

A field consisting of more than one value.

Parameters:
  • name (String) – The name of the field
  • fields – List of sub fields
class flextls.field.RandomField(name)[source]

Random data.

class flextls.field.SSLv2CipherSuiteField(name='unnamed')[source]

A cipher suite for SSLv2

class flextls.field.ServerDHParamsField(name)[source]

RFC5246 Section 7.4.3. Server Key Exchange Message

class flextls.field.ServerECDHParamsField(name)[source]

RFC4492 ECC Cipher Suites for TLS

class flextls.field.ServerNameField(name='test', **kwargs)[source]

The server name

class flextls.field.ServerNameListField(name)[source]

List of server names

Parameters:name (String) – The name of the field
class flextls.field.SignatureAndHashAlgorithmField(name)[source]

Representing a signature and hash algorithm

class flextls.field.UInt16EnumField(name, default, enums)[source]

The field should only use the defined values. The value must be an 16-Bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • default (Mixed) – A value defined in the enums list
  • enums (Dict) – List of possible values.
class flextls.field.UInt16Field(name, default)[source]

Field representing an 16-bit unsigned integer value(range: 0 through 65535 decimal).

class flextls.field.UInt24Field(name, default)[source]

Field representing an 16-bit unsigned integer value.

class flextls.field.UInt48Field(name, default)[source]

Field representing an 48-bit unsigned integer value.

class flextls.field.UInt8EnumField(name, default, enums)[source]

The field should only use the defined values. The value must be an 8-Bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • default (Mixed) – A value defined in the enums list
  • enums (Dict) – List of possible values.
class flextls.field.UInt8Field(name, default)[source]

Field representing an 8-bit unsigned integer value(range: 0 through 255 decimal).

class flextls.field.VectorBaseField(name, default='', fmt='H', connection=None)[source]

A vector as defined by the RFC is a single dimensioned array.

Parameters:
  • name (String) – The name of the field
  • default (Bytes) – Default value of the field
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorInt24Field(name)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 24-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorListBaseField(name, item_class=None, item_class_args=None, fmt='H')[source]

A vector as defined by the RFC is a single dimensioned array.

Parameters:
  • name (String) – The name of the field
  • item_class (flextls.field.Field) –
  • item_class_args (List) –
  • fmt (String) – The format string
class flextls.field.VectorListInt24Field(name, item_class=None, item_class_args=None)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 24-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • item_class (flextls.field.Field) –
  • item_class_args (List) –
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorListUInt16Field(name, item_class=None, item_class_args=None)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 16-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • item_class (flextls.field.Field) –
  • item_class_args (List) –
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorListUInt8Field(name, item_class=None, item_class_args=None)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 8-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • item_class (flextls.field.Field) –
  • item_class_args (List) –
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorUInt16Field(name)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 16-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • fmt (String) – The format string of the length identifier
class flextls.field.VectorUInt8Field(name)[source]

A vector as defined by the RFC is a single dimensioned array. The length identifier of this vector is a 8-bit unsigned integer.

Parameters:
  • name (String) – The name of the field
  • fmt (String) – The format string of the length identifier
class flextls.field.VersionField(name)[source]

The protocol version field.

Parameters:name (String) – Name of the field