SimpleSigner.load_pkcs12() passphrase utf-8 character error #434
-
if I call this code, it throws me:
If i use utf8 character in the password string then it throws me error! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This almost certainly means the PKCS#12 MAC did not validate and/or your payload decrypted to bogus data, i.e. the password is wrong, or you chose the wrong encoding. PKCS#12 passwords are binary data, not strings. So especially with non-ASCII passwords you have to be very careful to pick the same encoding as the one that was used to create the PKCS#12 file. You seem to be on Windows, which is not exactly known for its sane defaults when it comes to encodings... Assuming you generated the file yourself: the "correct" encoding is probably not UTF-8, but some old 8-bit codepage from the 80s or 90s that Microsoft doesn't dare to change because they don't want to break compatibility for people still running the '86 edition of WordPerfect. Joking aside, try EDIT: moving this to discussions, since it's not a bug in pyHanko. |
Beta Was this translation helpful? Give feedback.
This almost certainly means the PKCS#12 MAC did not validate and/or your payload decrypted to bogus data, i.e. the password is wrong, or you chose the wrong encoding. PKCS#12 passwords are binary data, not strings. So especially with non-ASCII passwords you have to be very careful to pick the same encoding as the one that was used to create the PKCS#12 file.
You seem to be on Windows, which is not exactly known for its sane defaults when it comes to encodings... Assuming you generated the file yourself: the "correct" encoding is probably not UTF-8, but some old 8-bit codepage from the 80s or 90s that Microsoft doesn't dare to change because they don't want to break compatibility for peopl…