Skip to content
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

[BUG]OpenSSH Invalid Private Key on 3.1 but not 3.0 #5440

Closed
john-michaelburke opened this issue Aug 28, 2020 · 1 comment
Closed

[BUG]OpenSSH Invalid Private Key on 3.1 but not 3.0 #5440

john-michaelburke opened this issue Aug 28, 2020 · 1 comment

Comments

@john-michaelburke
Copy link

  • Upgrade to the latest version of setuptools and pip: Successfully installed pip-20.2.2
  • Make sure you're on a supported version of OpenSSL. : openssl is already the newest version (1.1.1-1ubuntu2.1~18.04.6)
  • Try with the latest version of cryptography:
Package      Version
------------ -------
bcrypt       3.2.0
cffi         1.14.2
cryptography 3.1
paramiko     2.7.1
pip          20.2.2
pycparser    2.20
PyNaCl       1.4.0
setuptools   47.1.0
six          1.15.0

If none of that works, please make sure to include the following information in
your bug report:

  • I stumbled on this issue while using paramiko when attempting to load an OpenSSH private key. Using cryptography 3.1, I experience an this issue:
    ValueError: ('Invalid private key', [_OpenSSLErrorWithText(code=67764350, lib=4, func=160, reason=126, reason_text=b'error:040A007E:rsa routines:RSA_check_key_ex:iqmp not inverse of q')])

  • I uninstalled cryptography and reinstalled version 3.0 and the issue was resolved. The key loads fine.

  • To generate the type of key I experienced the issue with I ran this command:
    ssh-keygen -o -t rsa -b 4096 -C "[email protected]" -f test_rsa

  • Then pointing to that new key, I try to load the key using paramiko:
    python -c "import paramiko;paramiko.RSAKey.from_private_key_file('test_rsa')"

  • I apologize I am not showing steps to reproduce with cryptography. Hopefully, I was not in error posting this here.

@reaperhulk
Copy link
Member

This is a bug in paramiko: paramiko/paramiko#1723

You can see more info in #5434

freedge added a commit to freedge/ansibletest that referenced this issue Aug 29, 2020
freedge added a commit to freedge/ansibletest that referenced this issue Aug 29, 2020
freedge added a commit to freedge/ansibletest that referenced this issue Aug 29, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants