Skip to content

Commit b7cc501

Browse files
authored
Merge pull request #96 from mattsb42-aws/sha2
Add support for SHA384 and SHA512 for use with RSA OAEP wrapping algorithms
2 parents ea05804 + de86470 commit b7cc501

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
Changelog
33
*********
44

5+
1.3.8 -- 2018-xx-xx
6+
===================
7+
8+
Minor
9+
-----
10+
11+
* Add support to remove clients from :ref:`KMSMasterKeyProvider` client cache if they fail to connect to endpoint.
12+
`#86 <https://github.com/aws/aws-encryption-sdk-python/pull/86>`_
13+
* Add support for SHA384 and SHA512 for use with RSA OAEP wrapping algorithms.
14+
`#56 <https://github.com/aws/aws-encryption-sdk-python/issues/56>`_
15+
516
1.3.7 -- 2018-09-20
617
===================
718

src/aws_encryption_sdk/identifiers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ class WrappingAlgorithm(Enum):
271271
RSA_PKCS1 = (EncryptionType.ASYMMETRIC, rsa, padding.PKCS1v15, None, None)
272272
RSA_OAEP_SHA1_MGF1 = (EncryptionType.ASYMMETRIC, rsa, padding.OAEP, hashes.SHA1, padding.MGF1)
273273
RSA_OAEP_SHA256_MGF1 = (EncryptionType.ASYMMETRIC, rsa, padding.OAEP, hashes.SHA256, padding.MGF1)
274+
RSA_OAEP_SHA384_MGF1 = (EncryptionType.ASYMMETRIC, rsa, padding.OAEP, hashes.SHA384, padding.MGF1)
275+
RSA_OAEP_SHA512_MGF1 = (EncryptionType.ASYMMETRIC, rsa, padding.OAEP, hashes.SHA512, padding.MGF1)
274276

275277
def __init__(self, encryption_type, algorithm, padding_type, padding_algorithm, padding_mgf):
276278
"""Prepares new WrappingAlgorithm."""

test/functional/test_f_aws_encryption_sdk_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,19 @@ def test_encryption_cycle_raw_mkp(wrapping_algorithm, encryption_key_type, decry
334334

335335

336336
@pytest.mark.skipif(
337-
not _mgf1_sha256_supported(), reason="MGF1-SHA256 not supported by this backend: OpenSSL required v1.0.2+"
337+
not _mgf1_sha256_supported(), reason="MGF1-SHA2 not supported by this backend: OpenSSL required v1.0.2+"
338338
)
339339
@pytest.mark.parametrize(
340-
"wrapping_algorithm, encryption_key_type, decryption_key_type",
340+
"wrapping_algorithm",
341341
(
342-
(WrappingAlgorithm.RSA_OAEP_SHA256_MGF1, EncryptionKeyType.PRIVATE, EncryptionKeyType.PRIVATE),
343-
(WrappingAlgorithm.RSA_OAEP_SHA256_MGF1, EncryptionKeyType.PUBLIC, EncryptionKeyType.PRIVATE),
342+
WrappingAlgorithm.RSA_OAEP_SHA256_MGF1,
343+
WrappingAlgorithm.RSA_OAEP_SHA384_MGF1,
344+
WrappingAlgorithm.RSA_OAEP_SHA512_MGF1,
344345
),
345346
)
346-
def test_encryption_cycle_raw_mkp_openssl_102_plus(wrapping_algorithm, encryption_key_type, decryption_key_type):
347+
@pytest.mark.parametrize("encryption_key_type", (EncryptionKeyType.PUBLIC, EncryptionKeyType.PRIVATE))
348+
def test_encryption_cycle_raw_mkp_openssl_102_plus(wrapping_algorithm, encryption_key_type):
349+
decryption_key_type = EncryptionKeyType.PRIVATE
347350
encrypting_key_provider = build_fake_raw_key_provider(wrapping_algorithm, encryption_key_type)
348351
decrypting_key_provider = build_fake_raw_key_provider(wrapping_algorithm, decryption_key_type)
349352
ciphertext, _ = aws_encryption_sdk.encrypt(

test/functional/test_f_xcompat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def _file_root():
5757
b"OAEP-MGF1": {
5858
b"SHA-1": WrappingAlgorithm.RSA_OAEP_SHA1_MGF1,
5959
b"SHA-256": WrappingAlgorithm.RSA_OAEP_SHA256_MGF1,
60+
b"SHA-384": WrappingAlgorithm.RSA_OAEP_SHA384_MGF1,
61+
b"SHA-512": WrappingAlgorithm.RSA_OAEP_SHA512_MGF1,
6062
},
6163
}
6264
),

0 commit comments

Comments
 (0)