RSAES#
Module for RSAES.
- protocol crypto_condor.primitives.RSAES.DecryptOaep#
Bases:
Protocol
Represents a function that decrypts messages encrypted with RSAES-OAEP.
Classes that implement this protocol must have the following methods / attributes:
- __call__(private_key, ciphertext, label)#
Decrypts a message encrypted with RSA.
- Parameters:
private_key (bytes) – The private part of the key used to encrypt, in PEM format.
ciphertext (bytes) – The ciphertext to decrypt.
label (bytes) – The optional label, can be an empty byte-array (b””).
- Returns:
The plaintext.
- Return type:
bytes
- protocol crypto_condor.primitives.RSAES.DecryptPkcs#
Bases:
Protocol
Represents a function that decrypts messages encrypted with RSASSA-PKCS1-v1_5.
Classes that implement this protocol must have the following methods / attributes:
- __call__(private_key, ciphertext)#
Decrypts a message encrypted with RSA.
- Parameters:
private_key (bytes) – The private part of the key used to encrypt, in PEM format.
ciphertext (bytes) – The ciphertext to decrypt.
- Returns:
The plaintext.
- Return type:
bytes
- enum crypto_condor.primitives.RSAES.Wrapper(value)#
Bases:
StrEnum
Available wrappers.
- Member Type:
str
Valid values are as follows:
- PYTHON = <Wrapper.PYTHON: 'Python'>#
- crypto_condor.primitives.RSAES.run_rsaes_wrapper(language, scheme, hash_algorithm=None, mgf_hash=None)#
Runs the corresponding wrapper.
- Parameters:
- Returns:
Returns the value returned by
test_decrypt_pkcs()
ortest_decrypt_oaep()
.
- crypto_condor.primitives.RSAES.test_decrypt_oaep(decrypt_function, hash_algorithm, mgf_hash=None)#
Tests a function that decrypts RSAES-OAEP ciphertexts.
Only Wycheproof vectors are available.
- Parameters:
decrypt_function (DecryptOaep) – The function to test.
hash_algorithm (Hash) – The hash algorithm used to generate the ciphertexts.
mgf_hash (Hash | None) – The hash algorithm used with MGF1. If None, the same as
hash_algorithm
is used.
- Returns:
A dictionary of results, one for each test vectors file. The keys are “Wycheproof/decrypt/{filename}”.
- Return type:
- crypto_condor.primitives.RSAES.test_decrypt_pkcs(decrypt_function)#
Tests a function that decrypts RSAES-PKCS1-v1_5 ciphertexts.
Only Wycheproof vectors are available.
- Parameters:
decrypt_function (DecryptPkcs) – The function to test.
- Returns:
A dictionary of results, one for each test vectors file. The keys are “Wycheproof/decrypt/{filename}”.
- Return type: