Dilithium#

Supported parameters#

Dilithium has three parameter sets: these are supported and defined by Paramset.

enum crypto_condor.primitives.Dilithium.Paramset(value)#

Available parameter sets.

Member Type:

str

Valid values are as follows:

DILITHIUM2 = <Paramset.DILITHIUM2: 'Dilithium2'>#
DILITHIUM3 = <Paramset.DILITHIUM3: 'Dilithium3'>#
DILITHIUM5 = <Paramset.DILITHIUM5: 'Dilithium5'>#

Test a signing function#

crypto_condor.primitives.Dilithium.test_sign(sign, parameter_set)#

Tests a function that signs with Dilithium.

Signs messages with the given function and compares to the expected signature.

Parameters:
  • sign (Sign) – The function to test, must behave like Sign.

  • parameter_set (Paramset) – The parameter set to test the implementation on.

Returns:

The results of testing the given implementation with test vectors generated for the NIST submission.

Return type:

Results

Test a verifying function#

crypto_condor.primitives.Dilithium.test_verify(verify, parameter_set)#

Tests a function that verifies Dilithium signatures.

Parameters:
  • verify (Verify) – The function to test, must behave like Verify.

  • parameter_set (Paramset) – The parameter set to test the implementation on.

Returns:

The results of testing the given implementation with test vectors generated for the NIST submission.

Return type:

Results

Run a wrapper#

Note

Available wrappers are defined by Wrapper.

crypto_condor.primitives.Dilithium.run_wrapper(language, parameter_set, run_sign, run_verify)#

Runs the corresponding wrapper.

Parameters:
  • language (Wrapper) – The language of the wrapper to run.

  • parameter_set (Paramset) – The parameter set to use.

  • run_sign (bool) – Whether to run the signing function.

  • run_verify (bool) – Whether to run the verifying function.

Returns:

A dictionary of results, one for sign, one for verify. The keys are sign and verify.

Return type:

ResultsDict

enum crypto_condor.primitives.Dilithium.Wrapper(value)#

Available wrappers.

Member Type:

str

Valid values are as follows:

PYTHON = <Wrapper.PYTHON: 'Python'>#

Protocols#

protocol crypto_condor.primitives.Dilithium.Sign#

Represents a function that signs messages with Dilithium.

Classes that implement this protocol must have the following methods / attributes:

__call__(secret_key, message)#

Signs a message with Dilithium.

Parameters:
  • secret_key (bytes) – The key to use for signing.

  • message (bytes) – The message to sign.

Returns:

The signature.

Return type:

bytes

protocol crypto_condor.primitives.Dilithium.Verify#

Represents a function that verifies Dilithium signatures.

Classes that implement this protocol must have the following methods / attributes:

__call__(public_key, message, signature)#

Verifies a Dilithium signature.

Parameters:
  • public_key (bytes) – The public part of the key used to sign the message.

  • message (bytes) – The signed message.

  • signature (bytes) – The signature to verify.

Returns:

True if the signature is valid for the given key and message.

Return type:

bool