diff --git a/test/test_crypto.py b/test/test_crypto.py index 262a32d4..67915635 100644 --- a/test/test_crypto.py +++ b/test/test_crypto.py @@ -47,9 +47,51 @@ -----END RSA PUBLIC KEY----- """ -RSA_PUBLIC_KEY_DER = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCP57QHaY/nRDZpl0ydnKG8yhVqGo6Uh/a/wP8lPmwCyDeMuDN+I8j0PUgrdODsvNWQZO39A2WUWZ7OUbub881SqeraHCsnrJIELgtZLjRjwUj6y+jRHnUhFklvsNmVvV12RxIeWOgGaXTZIXfSBUxPD7TfCfIhg9+66ClH8Q7xpwIDAQAB/9gRpo4IuSpFgfvJkN67ddI3s+1FbTxxSbb6PcLYyhhkUv0/PolsTw3MXBANawIDAQAB' +RSA_PUBLIC_KEY_DER = """ +MIIBCgKCAQEAxaEsLWE2t3kJqsF1sFHYk7rSCGfGTSDa+3r5typT0cb/TtJ989C8 +dLcfInx4Dxq0ewo6NOxQ/TD8JevUda86jSh1UKEQUOl7qy+QwOhFMpwHq/uOgMy5 +khDDLlkxD5U32RrDfqLK+4WUDapHlQ6g+E6wS1j1yDRoTZJk3WnTpR0sJHsttLWV ++mb2wPC7TkhGMbFMzbt6v0ahF7abVOOGiHVZ77uhS66hgP9nfgMHug8EN/xmVc/T +xgMJci1Irh66xVZQ9aT2OZwb0TXglULm+b8HM+GKHgoTMwr9gAGpFDoYi22PvxC/ +cqKHKIaYw7KNOPwImzQ6cp5oQJTAPQKRUwIDAQAB +""" + +RSA_PUBLIC_KEY_DER_BOTO3 = """ +MIIBCgKCAQEAmC9Sp2vAK8r/B+5SvW4iMwU1wqwMISzuJqsFLLp6b/shkeDSN+quD +Fn2ngSyd4dzut0Uk2/hshFWQhXhutmrnHZf4jx2ri1IAEV3f8/f8o/sajMtupD5HT +ltyXhQIL8Dzcprq4GyXYKAhD+W9O3GDUuMnP6aTbjMO2kOmE4GedA+RU+9L3AI/CF +g5zgnzpQ3CCnCxrDK/ARaE4mB5L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8r3Syo600Aayd4XLTe7HplllFZs62N +2xLs5n1Be7P0X+oWRgZVx/e5T3u8H6/98/DGFzui4A0EZlURBwFMII1xsnO6wpnw +ODNyC9t5zt1nCWh9HdZveQKBgAm4+E8eRZVNcm83pSXSS3Mfhsn7lDBn5aqy6Mya +HqhB/H+G/8mGSKFrCvbpl/PTpOUMMFXdiYYzpkQoPUkO3w5WYgC4qQwb9lKA7e6w +sCjwYbduzgbrbKMfJWHSTBXcvnaY0Kx4UnR4Zi3HNYw4wlnBYfAb55RCWykF6aWj +9neFAoGBAMqQA2YWCHhnRtjn4iGMrTk8iOHBd8AGBBzX9rPKXDqWlOr/iQq90qX0 +59309stR/bAhMzxOx31777XEPO1md854iXXr0XDMQlwCYkWyWb6hp4JlsqFBPMjn +nGXWA0Gp6UWgpg4Hvjdsu+0FQ3AhDMBKZZ8fBFb4EW+HRQIHPnbH +""" class TestCredentials(NativeResourceTest): @@ -204,6 +246,9 @@ def test_rsa_load_error(self): with self.assertRaises(ValueError): RSA.new_public_key_from_pem_data(RSA_PRIVATE_KEY_PEM) + def test_does_it_load(self): + RSA.new_private_key_from_der_data(RSA_PUBLIC_KEY_DER_BOTO3) + def test_rsa_signing_verify_fail(self): h = Hash.sha256_new() h.update(b'totally original test string')