RSAES test vectors#

Test vectors for RSAES.

enum crypto_condor.vectors.RSAES.Hash(value)#

Bases: StrEnum

Available hash functions.

Member Type:

str

Valid values are as follows:

SHA_1 = <Hash.SHA_1: 'SHA-1'>#
SHA_224 = <Hash.SHA_224: 'SHA-224'>#
SHA_256 = <Hash.SHA_256: 'SHA-256'>#
SHA_384 = <Hash.SHA_384: 'SHA-384'>#
SHA_512 = <Hash.SHA_512: 'SHA-512'>#
SHA_512_224 = <Hash.SHA_512_224: 'SHA-512/224'>#
SHA_512_256 = <Hash.SHA_512_256: 'SHA-512/256'>#
SHA3_224 = <Hash.SHA3_224: 'SHA3-224'>#
SHA3_256 = <Hash.SHA3_256: 'SHA3-256'>#
SHA3_384 = <Hash.SHA3_384: 'SHA3-384'>#
SHA3_512 = <Hash.SHA3_512: 'SHA3-512'>#
class crypto_condor.vectors.RSAES.RsaDecVectors(scheme, hash_algorithm, mgf_hash, wycheproof)#

Bases: object

RSA vectors for ciphertext decryption.

Do not instantiate directly, use load().

Parameters:
  • scheme (Scheme) – The encryption scheme of the test vectors.

  • hash_algorithm (Hash | None) – (RSAES-OAEP only) The hash algorithm used to generate the vectors.

  • mgf_hash (Hash | None) – (RSAES-OAEP only) The MGF1 hash algorithm used to generate the vectors.

  • wycheproof (dict[str, RsaWycheproofEncVectors] | None) – The loaded Wycheproof vectors. None if there are no vectors available for the given hash algorithm and MGF1 hash, if applicable.

Example

Using load() to load the test vectors:

>>> from crypto_condor.vectors.RSAES import Scheme, Hash, RsaDecVectors
>>> scheme = Scheme.PKCS
>>> hash_algorithm = Hash.SHA_256
>>> vectors = RsaDecVectors.load(scheme, hash_algorithm)
classmethod load(scheme, hash_algorithm=None, mgf_hash=None)#

Loads RSAES decryption vectors.

Parameters:
  • scheme (Scheme) – The encryption scheme to get vectors of.

  • hash_algorithm (Hash | None) – (RSAES-OAEP only) The hash algorithm used to generate the ciphertexts.

  • mgf_hash (Hash | None) – (RSAES-OAEP only) The MGF1 hash algorithm used to generate the ciphertexts. If None, the same one as hash_algorithm is used.

Returns:

An instance of RsaDecVectors.

class crypto_condor.vectors.RSAES.RsaWycheproofEncGroup#

Bases: TypedDict

Represents a single Wycheproof decryption group.

class crypto_condor.vectors.RSAES.RsaWycheproofEncTest#

Bases: TypedDict

Represents a single Wycheproof decryption test.

class crypto_condor.vectors.RSAES.RsaWycheproofEncVectors#

Bases: TypedDict

Represents a file of Wycheproof decryption vectors.

enum crypto_condor.vectors.RSAES.Scheme(value)#

Bases: StrEnum

RSA encryption schemes.

Member Type:

str

Valid values are as follows:

OAEP = <Scheme.OAEP: 'RSAES-OAEP'>#
PKCS = <Scheme.PKCS: 'RSAES-PKCS1-v1_5'>#
crypto_condor.vectors.RSAES.load_wycheproof_vectors(scheme, hash_algorithm=None, mgf_hash=None)#

Loads Wycheproof test vectors.

Parameters:
  • scheme (Scheme) – The scheme of the test vectors to load.

  • hash_algorithm (Hash | None) – The hash algorithm used to generate the test vectors.

  • mgf_hash (Hash | None) – The MGF1 hash algorithm used to generate RSAES-OAEP vectors, None for other schemes.

Returns:

A dictionary of test vectors, indexed by the names of the files loaded, or None if there aren’t vectors for the given parameters.

Return type:

dict[str, RsaWycheproofEncVectors] | None