DHParameterNumbers object has no attribute '_p'
exploide opened this issue · 0 comments
exploide commented
Describe the bug
Starting PowerHub results in the exception AttributeError: 'cryptography.hazmat.primitives.asymmetric.dh.DHParameterNumbers' object has no attribute '_p'. Did you mean: 'p'?
.
To Reproduce
Steps to reproduce the behavior:
- Install and start PowerHub
- See error
Logs (please complete the following information):
Python log:
$ powerhub --auth hub:test 10.15.22.6
I 2024-01-29 10:20:25 Generating new Diffie-Hellman parameters
Traceback (most recent call last):
File "/home/user/.local/bin/powerhub", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/__main__.py", line 13, in main
PowerHubApp(args).run(background=background)
^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/app.py", line 72, in __init__
self.init_flask()
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/app.py", line 118, in init_flask
from powerhub.flask import app as flask_blueprint
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/flask.py", line 22, in <module>
from powerhub.hiddenapp import hidden_app
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/hiddenapp.py", line 13, in <module>
from powerhub.dhkex import DH_G, DH_MODULUS, DH_ENDPOINT
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/dhkex.py", line 73, in <module>
generate_diffie_hellman_params()
File "/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/dhkex.py", line 22, in generate_diffie_hellman_params
p = parameters.parameter_numbers()._p
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'cryptography.hazmat.primitives.asymmetric.dh.DHParameterNumbers' object has no attribute '_p'. Did you mean: 'p'?
Python versions (please complete the following information):
- Output of
python --version
: 3.12.1 - Output of
pip freeze
:
$ pipx runpip powerhub freeze
attrs==23.2.0
Automat==22.10.0
bidict==0.22.1
blinker==1.7.0
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
cheroot==10.0.0
click==8.1.7
constantly==23.10.4
cryptography==42.0.1
defusedxml==0.7.1
dnspython==2.5.0
Flask==3.0.1
Flask-SocketIO==5.3.6
Flask-SQLAlchemy==3.1.1
greenlet==3.0.3
h11==0.14.0
hyperlink==21.0.0
idna==3.6
incremental==22.10.0
itsdangerous==2.1.2
jaraco.functools==4.0.0
Jinja2==3.1.3
json5==0.9.14
MarkupSafe==2.1.4
more-itertools==10.2.0
powerhub @ file:///home/user/repos/PowerHub
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
pyOpenSSL==24.0.0
python-engineio==4.8.2
python-magic==0.4.27
python-socketio==5.11.0
PyYAML==6.0.1
requests==2.31.0
service-identity==24.1.0
setuptools==69.0.2
simple-websocket==1.0.0
six==1.16.0
SQLAlchemy==2.0.25
Twisted==23.10.0
typing_extensions==4.9.0
urllib3==2.1.0
watchdog==3.0.0
Werkzeug==3.0.1
wheel==0.42.0
WsgiDAV==4.3.0
wsproto==1.2.0
zope.interface==6.1
Additional context
The issue can simply be fixed by accessing .p
instead of ._p
. Maybe something changed in the library used?
Besides, there is also a deprecation warning, but this seems unrelated:
/home/user/.local/pipx/venvs/powerhub/lib64/python3.12/site-packages/powerhub/tools.py:77: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to not_valid_after_utc.