request.tests.openssl_keygen_factoryΒΆ

ClassesΒΆ

KeyGenerationComponent

Abstract base class for key generation components.

RSAKeyGenerator

RSA key generation using OpenSSL genrsa command.

ECKeyGenerator

ECC key generation using OpenSSL ecparam command.

KeyFileOutput

Component for specifying the output file (-out argument).

CompositeKeyGenerator

Composite key generator that combines multiple components.

Module ContentsΒΆ

class request.tests.openssl_keygen_factory.KeyGenerationComponent[source]ΒΆ

Bases: abc.ABC

Abstract base class for key generation components.

abstractmethod build_args(context)[source]ΒΆ

Build command arguments for this component.

Parameters:

context (dict[str, Any])

Return type:

list[str]

abstractmethod get_description()[source]ΒΆ

Get human-readable description of this component.

Return type:

str

class request.tests.openssl_keygen_factory.RSAKeyGenerator(key_size=2048)[source]ΒΆ

Bases: KeyGenerationComponent

RSA key generation using OpenSSL genrsa command.

Parameters:

key_size (int)

key_size = 2048[source]ΒΆ
build_args(context)[source]ΒΆ

Build OpenSSL genrsa command arguments.

Parameters:

context (dict[str, Any])

Return type:

list[str]

get_key_size_args()[source]ΒΆ

Get the key size argument that should come at the end.

Return type:

list[str]

get_description()[source]ΒΆ

Get human-readable description of this component.

Return type:

str

get_priority()[source]ΒΆ

RSA generator should come first.

Return type:

int

class request.tests.openssl_keygen_factory.ECKeyGenerator(curve_name='secp256r1')[source]ΒΆ

Bases: KeyGenerationComponent

ECC key generation using OpenSSL ecparam command.

Parameters:

curve_name (str)

curve_name = 'secp256r1'[source]ΒΆ
build_args(context)[source]ΒΆ

Build OpenSSL ecparam command arguments.

Parameters:

context (dict[str, Any])

Return type:

list[str]

get_description()[source]ΒΆ

Get human-readable description of this component.

Return type:

str

get_priority()[source]ΒΆ

EC generator should come first.

Return type:

int

class request.tests.openssl_keygen_factory.KeyFileOutput(file_path=None, auto_generate_path=True)[source]ΒΆ

Bases: KeyGenerationComponent

Component for specifying the output file (-out argument).

Parameters:
  • file_path (str | None)

  • auto_generate_path (bool)

file_path = '/tmp/key.pem'[source]ΒΆ
auto_generate_path = True[source]ΒΆ
build_args(context)[source]ΒΆ

Build -out argument with file path.

Parameters:

context (dict[str, Any])

Return type:

list[str]

get_description()[source]ΒΆ

Get human-readable description of this component.

Return type:

str

get_priority()[source]ΒΆ

Output should come before the key size.

Return type:

int

class request.tests.openssl_keygen_factory.CompositeKeyGenerator(name, description=None)[source]ΒΆ

Composite key generator that combines multiple components.

Parameters:
  • name (str)

  • description (str)

name[source]ΒΆ
description[source]ΒΆ
components: list[KeyGenerationComponent] = [][source]ΒΆ
add_component(component)[source]ΒΆ

Add a component to this composite generator.

Parameters:

component (KeyGenerationComponent)

Return type:

CompositeKeyGenerator

build_command(context=None)[source]ΒΆ

Build the complete OpenSSL command from all components.

Parameters:

context (dict[str, Any])

Return type:

list[str]

_set_key_type_in_context(context)[source]ΒΆ

Set the key type in context based on the generator component.

Parameters:

context (dict[str, Any])

Return type:

None

get_description()[source]ΒΆ

Get complete description of this composite generator.

Return type:

str

__str__()[source]ΒΆ

String representation.

Return type:

str

__repr__()[source]ΒΆ

Detailed representation.

Return type:

str