Run

Module for the “test wrapper” command.

enum crypto_condor.cli.run.AesStrKeyLength(value)

Bases: StrEnum

Workaround for using IntEnum with Typer.

Typer/Click don’t handle ints as choices from an enum, so mimic the real enum with str values and convert back when calling the function.

Member Type:

str

Valid values are as follows:

ALL = <AesStrKeyLength.ALL: '0'>
AES128 = <AesStrKeyLength.AES128: '128'>
AES192 = <AesStrKeyLength.AES192: '192'>
AES256 = <AesStrKeyLength.AES256: '256'>
crypto_condor.cli.run.aes(
wrapper,
mode,
key_length=AesStrKeyLength.ALL,
iv_length=0,
compliance=True,
resilience=False,
encrypt=True,
decrypt=True,
filename='',
no_save=False,
debug=None,
)

Runs an AES wrapper.

Parameters:
  • wrapper (Annotated[str, <typer.models.ArgumentInfo object at 0x7ff05b1f9690>]) – The wrapper to test.

  • mode (Annotated[Mode, <typer.models.ArgumentInfo object at 0x7ff05bdee310>]) – The mode of operation.

  • key_length (Annotated[AesStrKeyLength, <typer.models.ArgumentInfo object at 0x7ff05b1f9710>]) – The length of the keys to use in bits.

  • iv_length (Annotated[int, <typer.models.OptionInfo object at 0x7ff05b1f98d0>]) – The length of the IV that can be tested.

  • compliance (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05c8df150>]) – Whether to use compliance test vectors.

  • resilience (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05bdec890>]) – Whether to use resilience test vectors.

  • encrypt (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9350>]) – Whether to test encryption.

  • decrypt (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9410>]) – Whether to test decryption.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

Notes

  • no_encrypt and no_decrypt should not be True at the same time.

  • no_compliance and no_resilience should not be True at the same time.

crypto_condor.cli.run.ecdsa(
language,
curve,
hash_function,
key_encoding=None,
pubkey_encoding=None,
pre_hashed=False,
compliance=True,
resilience=False,
test_sign=True,
test_verify=True,
test_sign_then_verify=False,
filename='',
no_save=False,
debug=None,
)

Runs an ECDSA wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper.

  • curve (Annotated[Curve, <typer.models.ArgumentInfo object at 0x7ff05c8789d0>]) – The elliptic curve to use.

  • hash_function (Annotated[Hash, <typer.models.ArgumentInfo object at 0x7ff05b1f9ed0>]) – The hash function to use.

  • key_encoding (Annotated[KeyEncoding | None, <typer.models.OptionInfo object at 0x7ff05b1fa1d0>]) – The encoding used for private keys.

  • pubkey_encoding (Annotated[PubKeyEncoding | None, <typer.models.OptionInfo object at 0x7ff05b1fa3d0>]) – The encoding used for public keys.

  • pre_hashed (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1fa450>]) – Whether the messages given to the implementation must be hashed first.

  • compliance (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05c8df150>]) – Whether to use compliance test vectors.

  • resilience (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05bdec890>]) – Whether to use resilience test vectors.

  • test_sign (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9450>]) – Whether to test the signing function.

  • test_verify (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f93d0>]) – Whether to test the verifying function.

  • test_sign_then_verify (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1fa510>]) – Whether to test both functions by signing then verifying.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

Notes

  • compliance and resilience should not be False at the same time unless test_sign_then_verify is used.

  • test_sign, test_verify, and test_sign_then_verify should not be False at the same time.

crypto_condor.cli.run.kyber(
language,
parameter_set,
encapsulate=True,
decapsulate=True,
filename='',
no_save=False,
debug=None,
)

Runs a Kyber wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper to run.

  • parameter_set (Annotated[Paramset, <typer.models.ArgumentInfo object at 0x7ff05b1fa7d0>]) – The Kyber parameter set to use.

  • encapsulate (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1fa8d0>]) – Whether to test the encapsulation function.

  • decapsulate (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1fa9d0>]) – Whether to test the decapsulation function.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.dilithium(
language,
parameter_set,
sign=True,
verify=True,
filename='',
no_save=False,
debug=None,
)

Runs a Dilithium wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper to run.

  • parameter_set (Annotated[Paramset, <typer.models.ArgumentInfo object at 0x7ff05b1fac10>]) – The Dilithium parameter set to use.

  • sign (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9450>]) – Whether to test the signing function.

  • verify (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f93d0>]) – Whether to test the verifying function.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.sha(
wrapper,
algorithm,
orientation=Orientation.BYTE,
filename='',
no_save=False,
debug=None,
)

Runs a SHA wrapper.

Parameters:
  • wrapper (Annotated[str, <typer.models.ArgumentInfo object at 0x7ff05b1fae10>]) – The wrapper to test.

  • algorithm (Annotated[Algorithm, <typer.models.ArgumentInfo object at 0x7ff05b1fae90>]) – The SHA algorithm to test.

  • orientation (Annotated[Orientation, <typer.models.ArgumentInfo object at 0x7ff05b1faf90>]) – The orientation of the implementation, either bit- or byte-oriented.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.shake(language, algorithm, orientation, filename='', no_save=False, debug=None)

Runs a SHAKE wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper to run.

  • algorithm (Annotated[Algorithm, <typer.models.ArgumentInfo object at 0x7ff05b1fb150>]) – The SHAKE algorithm to test.

  • orientation (Annotated[Orientation, <typer.models.ArgumentInfo object at 0x7ff05b1fb250>]) – The orientation of the implementation, either bit- or byte-oriented.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.rsassa(
language,
scheme,
sha,
mgf_sha=None,
sign=True,
verify=True,
filename='',
no_save=False,
debug=None,
)

Runs an RSA wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper to run.

  • scheme (Annotated[Scheme, <typer.models.ArgumentInfo object at 0x7ff05b1fb450>]) – The RSA scheme to test.

  • sha (Annotated[Hash, <typer.models.ArgumentInfo object at 0x7ff05b1fb550>]) – The SHA to use.

  • mgf_sha (Annotated[Hash | None, <typer.models.OptionInfo object at 0x7ff05b1fb850>]) – (RSASSA-PSS only) The SHA to use with MGF1.

  • sign (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9450>]) – Whether to test the signing function.

  • verify (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f93d0>]) – Whether to test the verifying function.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.rsaes(
language,
scheme,
sha=None,
mgf_sha=None,
filename='',
no_save=False,
debug=None,
)

Runs a RSAES wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper to run.

  • scheme (Annotated[Scheme, <typer.models.ArgumentInfo object at 0x7ff05b1fb990>]) – The RSA scheme to test.

  • sha (Annotated[Hash | None, <typer.models.OptionInfo object at 0x7ff05b1fbc50>]) – The SHA to use in RSAES-OAEP.

  • mgf_sha (Annotated[Hash | None, <typer.models.OptionInfo object at 0x7ff05b1fbcd0>]) – The SHA to use with MGF1 in RSAES-OAEP.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

crypto_condor.cli.run.chacha20(
language,
mode,
resilience=True,
encrypt=True,
decrypt=True,
filename='',
no_save=False,
debug=None,
)

Runs an ChaCha20 wrapper.

Parameters:
  • language (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c87c510>]) – The language of the wrapper.

  • mode (Annotated[Mode, <typer.models.ArgumentInfo object at 0x7ff05bdee310>]) – The mode of operation.

  • resilience (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05bdec890>]) – Whether to use resilience test vectors.

  • encrypt (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9350>]) – Whether to test encryption.

  • decrypt (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9410>]) – Whether to test decryption.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.

Notes

  • encrypt and decrypt should not be False at the same time.

  • If resilience if False, no test can be done.

crypto_condor.cli.run.hmac(
language,
hash_function,
compliance=True,
resilience=False,
filename='',
no_save=False,
debug=None,
)

Runs an HMAC wrapper.

crypto_condor.cli.run.ecdh(
lang,
curve,
wrapper='ECDH_wrapper.py',
compliance=True,
resilience=False,
filename='',
no_save=False,
debug=None,
)

Runs an ECDH wrapper.

Parameters:
  • lang (Annotated[Wrapper, <typer.models.ArgumentInfo object at 0x7ff05c8f4450>]) – The language of the wrapper.

  • curve (Annotated[Curve, <typer.models.ArgumentInfo object at 0x7ff05b1dc250>]) – The elliptic curve to use.

  • wrapper (Annotated[str, <typer.models.ArgumentInfo object at 0x7ff05b1dc350>]) – The name of the wrapper, ECDH_wrapper.py by default.

  • compliance (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05c8df150>]) – Whether to use compliance test vectors.

  • resilience (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05bdec890>]) – Whether to use resilience test vectors.

  • filename (Annotated[str, <typer.models.OptionInfo object at 0x7ff05b1f94d0>]) – Name of the file to save results.

  • no_save (Annotated[bool, <typer.models.OptionInfo object at 0x7ff05b1f9550>]) – Do not save results or prompt the user.

  • debug (Annotated[bool | None, <typer.models.OptionInfo object at 0x7ff05b1f9610>]) – When saving the results to a file, whether to add the debug data.