nopasaran.primitives.action_primitives.tls_primitives.TLSPrimitives

class nopasaran.primitives.action_primitives.tls_primitives.TLSPrimitives

Bases: object

Class containing TLS action primitives for the state machine.

__init__()

Methods

__init__()

extract_public_key(inputs, outputs, ...)

Extract the public key from a PEM-encoded certificate and store it in an output variable in the machine's state.

get_certificate(inputs, outputs, state_machine)

Retrieve the certificate from a given IP address, port, and hostname, and store it in an output variable in the machine's state.

start_ssl_server(inputs, outputs, state_machine)

Start an SSL server with the given certificate, key, host, port, and timeout.

static extract_public_key(inputs, outputs, state_machine)

Extract the public key from a PEM-encoded certificate and store it in an output variable in the machine’s state.

Number of input arguments: 1

Number of output arguments: 1

Optional input arguments: No

Optional output arguments: No

Args:

inputs (List[str]): The list of input variable names. It contains one mandatory input argument, which is the name of the variable containing the PEM-encoded certificate.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument, which is the name of the variable to store the extracted public key in PEM format.

state_machine: The state machine object.

Returns:

None

static get_certificate(inputs, outputs, state_machine)

Retrieve the certificate from a given IP address, port, and hostname, and store it in an output variable in the machine’s state.

Number of input arguments: 3

Number of output arguments: 1

Optional input arguments: No

Optional output arguments: No

Args:

inputs (List[str]): The list of input variable names. It contains three mandatory input arguments (IP address, port, and hostname).

outputs (List[str]): The list of output variable names. It contains one mandatory output argument, which is the name of the variable to store the retrieved certificate.

state_machine: The state machine object.

Returns:

None

static start_ssl_server(inputs, outputs, state_machine)

Start an SSL server with the given certificate, key, host, port, and timeout.

Number of input arguments: 5

Number of output arguments: 0

Optional input arguments: No

Optional output arguments: No

Args:
inputs (List[str]): The list of input variable names. It contains five mandatory input arguments:
  • The name of the variable containing the certificate bytes.

  • The name of the variable containing the key bytes.

  • The name of the variable containing the host.

  • The name of the variable containing the port.

  • The name of the variable containing the timeout.

outputs (List[str]): The list of output variable names. (None for this method)

state_machine: The state machine object.

Returns:

None