-
Notifications
You must be signed in to change notification settings - Fork 50
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
unexpected test_rsa failure #462
Comments
happened again, different python version but same test |
same test, this time on windows |
The only thing that changes between test runs is the private key: securesystemslib/tests/test_interface.py Line 159 in 515c56d
Would be interesting to see what the private key looks like, when the test fails. |
I was able to trigger the error after a couple (100 or so) iterations on a Debian box using this script: from securesystemslib import keys
path = "key"
while True:
print("Create key")
key_pair = keys.generate_rsa_key(3072)
encrypted_key = keys.create_rsa_encrypted_pem(key_pair["keyval"]["private"], "pw")
try:
keys.import_rsakey_from_private_pem(encrypted_key, "rsassa-pss-sha256", "bad pw")
except Exception as e:
if "Could not deserialize key" in str(e):
breakpoint() ... but there wasn't anything unusual about that key. |
So likely this points to some flakiness in openssl 😬 Should we make the test here succeed on either error message? |
Oh interesting, it depends on the password. I think I'll leave this for the crypto experts to debug. Maybe worth creating in issue on pyca/cryptography... @jku, can you reproduce this? from cryptography.hazmat.primitives.serialization import load_pem_private_key
encrypted_rsa_key = b"-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: AES-256-CBC,6EF2C95AF143341584114A13ED0A8C06\n\nXqSK8L2MLJBHATHIslIYqWklO9nncVgt/vy0tntlNkVafuMs7PKzL9bHvJU5w2UG\n1inznGkrNzCjkjN3RLQ0Cd2uWQPOw/zyk6HH66ORXxmQtubKq9gkZwo7IHd+TAZJ\nsbmYYSO+DeKFPSmjOS5srr9wulBz4dggLiiVwPx1PCoMiHePDW63Tt1wtdW6TNWL\na4tZ/GF3YBoNJjHLCwmTL0ueaiUfw2/uNKpgUUAN/3tDOlFmoO/lRbil/IF+pcH3\nETy+ShVULuwHzSEkt+73NdwcR5z7k5DgYA0yZvqwm76KtVsqTZ8VuueIxU9zpwRw\ncH5SqkhoY6e3xgzTqWtgwkm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OY+75dq52tMcZgaqJbhKsH\nuDyqpxBiySlLfAtZjyLohPnD8pZIfvHTvfTaipzgeXhAq9yaXNLiRT4Z2OPByfeE\nkZkbn7YgU0DtDretdOdl6+Pw9yFwWTwA++1Xp8CHYeYBvQyWUYfTCKCRRVEXT/sN\nW2VKJXSSsa5SJ3ZV8c8cDsXO+b0xAwDL+k6cc09mGauvHqV8AGHPsP2iacV+ZRtT\nB/6h8ZNoJKPXwc1bgm+dg65WOn0b5BFgcMSRGaEmttn8C36nTFthiL9AtrmYKmjv\ny0kL4KWPupguqzG1dpVgpOy++C0gF3+jCUirgVDwZRUY8lgTYa1l+Ko903R2e06j\npfC4ASJPdB+pwCrEJwaEfCHPhzeEMVl5SfRzpquIjBjYNFaQ/tzYVm/EUZiiCVGu\nABJHV6u+khj4bWXho5+STNkbZ4bKpZcnBCf7xVV3ckSg8158EOIbSEFaVC3JiNBH\nf4yN24x5gqFQm3UfmeDm15QT54RiISxKADmfEFqirtIGxPTzm4f4xH9tH6KrcPH8\n3Ak0dn4bxCE6/VGTNG9KmxkiIKP8OKjVdehXxhcqesfrhFfNUfOoSvzBWsLMa+IL\ngul9/QsFnd69Xu8YQZSAIrlqJZd8GA9J9LgVC2VurqELBBN2lUiPinp8vjmTQLAa\nXzFvP7zPd5TKubFA+8W9ASHRplMdbtP1ej8CWmRO37eqamq45hsiONq9hsg1ngbA\nFGyaP4lmuCpqg0jog7c8tZjJhLfySK0VzbxDOem3WmRE/eamzoOE+f9vSUJXjBZY\noP7kuEvbllmPnkxQi6YkWUgs/ovpH2WdKFm1vsci4xoNfLCS19L8AUVqUW4BeEqG\nOs4mgp98bxPHHxmdWNtFPotGSn2JC7uyZaL/6EkaUvnWc9vogZzwMiLo0gXmtWDn\nwj+qvGOISzVJ5E0CivpEkRsFxuSVgYL7lfwmbKanEZyqm26/bDaFm3Ie+jNy4z+F\n-----END RSA PRIVATE KEY-----"
# Parse and decrypt successfully with valid password
load_pem_private_key(encrypted_rsa_key, b"pw")
# Fail with invalid password and expected error message: "Bad decrypt. Incorrect password?"
load_pem_private_key(encrypted_rsa_key, b"not pw")
# Fail with different invalid password and unexpected error message: "Could not deserialize key data..."
load_pem_private_key(encrypted_rsa_key, b"bad pw") |
yes, I see the same errors |
Let's assume this is fixed with #546, reopen if not |
Failure on CI (python 3.10 Ubuntu): openssl error message is different from expected
The openssl output with some linebreaks:
Failing run: https://github.com/secure-systems-lab/securesystemslib/actions/runs/3546570396/jobs/5955750691
Earlier successful run with only unrelated code changes https://github.com/secure-systems-lab/securesystemslib/actions/runs/3530872651/jobs/5923516701
Issue seems to be an unexpected message from openssl... but I don't see how openssl could have changed given the above...
The text was updated successfully, but these errors were encountered: