-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for RSA_R_OAEP_DECODING_ERROR error flag. #2323
Closed
EnTeQuAk
wants to merge
6
commits into
pyca:master
from
EnTeQuAk:feature/add_rsa_r_oaep_decoding_error
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dd54e24
Add support for RSA_R_OAEP_DECODING_ERROR error flag.
EnTeQuAk 7c803a1
Add simple test that would fail on decryption
EnTeQuAk 3a4209a
Fixed test scenario to use different key.
EnTeQuAk af576e7
Fix test again and add pytest.raises statement
EnTeQuAk d1ffe48
Move private key initialization out of pytest.raises block
EnTeQuAk 14fd132
Merge branch 'master' of https://github.com/pyca/cryptography into fe…
EnTeQuAk File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
from cryptography.hazmat.primitives.ciphers.modes import CBC, CTR, Mode | ||
|
||
from ..primitives.fixtures_dsa import DSA_KEY_2048 | ||
from ..primitives.fixtures_rsa import RSA_KEY_2048, RSA_KEY_512 | ||
from ..primitives.fixtures_rsa import RSA_KEY_2048, RSA_KEY_512, RSA_KEY_512_ALT | ||
from ..primitives.test_ec import _skip_curve_unsupported | ||
from ...utils import load_vectors_from_file, raises_unsupported_algorithm | ||
|
||
|
@@ -467,6 +467,28 @@ def test_unsupported_oaep_label_decrypt(self): | |
) | ||
) | ||
|
||
def test_supported_oaep_decrypt(self): | ||
private_key = RSA_KEY_512.private_key(backend) | ||
|
||
ciphertext = private_key.public_key().encrypt( | ||
b'secure data', | ||
padding.OAEP( | ||
mgf=padding.MGF1(algorithm=hashes.SHA1()), | ||
algorithm=hashes.SHA1(), | ||
label=None | ||
) | ||
) | ||
|
||
with pytest.raises(ValueError): | ||
RSA_KEY_512_ALT.private_key(backend).decrypt( | ||
ciphertext, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
padding.OAEP( | ||
mgf=padding.MGF1(algorithm=hashes.SHA1()), | ||
algorithm=hashes.SHA1(), | ||
label=None | ||
) | ||
) | ||
|
||
|
||
@pytest.mark.skipif( | ||
backend._lib.OPENSSL_VERSION_NUMBER <= 0x10001000, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long, you'll need to format it: