-
Notifications
You must be signed in to change notification settings - Fork 33
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
Invalid empty password #44
Comments
No, this change in behavior is unintentional. The only relevant change from 1.15 to 1.16 was to drop
Pull requests with improvements to |
As a side note, I also don't like how we need to go through temporary files to use |
I take responsibility for the problematic commits. The exception is raised by requests_pkcs12/requests_pkcs12.py Line 52 in 2049d6b
cryptography.hazmat.primitives.serialization.NoEncryption maybe works but maybe not wise. Using empty string passwords is considered a bad practice so the "cryptography" decided to put in place some enforcement.
Regarding the side note I conducted some research into avoiding temporary files. This was a longstanding feature request for the standard library Maybe the only options to avoiding temporary files are to find or wait for another library that implements the now deprecated functionality of |
I'm not against this, but would like to point out that this would only make sense if it was equivalent to an empty password in the pyOpenSSL implementation. Otherwise it would not be backwards compatible and hence still make old code fail. @ggoulart What kind of PKCS12 files did you open by providing an empty string as password? Are they just unencrypted, or do they use some kind of encryption, just with a dead simple password?
Okay, so it seems we didn't overlook anything, it just doesn't exist. This is too bad. |
Hi @vog I'm using a pfx certificate with an empty string as password. Yes, it is encryption with a dead simple password. |
I have a case with no password when loading certificate from memory, creating pull request. If needed it can be bound specifically pkcs12_data parameter. Pull request #45 |
I'm a bit confused. What exactly do you mean by "could re-add the password"? |
I have the same issue for 1.18. Works when downgrading to 1.15. Running Python 3.9 and did a clean dependency installation.
|
I think I found an acceptable solution for this messy situation. If verified that the old pyOpenSSL based implementation in 1.15 behaves identically for an empty password and a None password. So I believe it is safe to treat those cases equally, i.e. to treat an empty password as if it was None. |
In version 1.16 the argument
pkcs12_password
can not be an empty string, but in version 1.15 it works.This is the error received in version 1.16
raise ValueError("Password must be 1 or more bytes.")
This is an expected behavior?
The text was updated successfully, but these errors were encountered: