You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing a valid public key ".cer" file, I run into a server 500 error your django pyas2 (v1.2.0)
I switched to debug and found that you do a plain item.decode("utf8").
In utils.py function "extract_certificate_info" you do this e.g. in line 248 cert_info["subject"] = [ tuple(item.decode("utf8") for item in sets) for sets in certificate.get_subject().get_components() ]
If there is a non valid utf8 token in the subject, the function crashes.
The easy fix is to instruct the decode function to escape all non utf8 characters with a simple and convenient parameter in Python 3+:
item.decode("utf8","backslashreplace")
Maybe this can be used for all relevant utf8 decodings
Cheers James
The text was updated successfully, but these errors were encountered:
chadgates
added a commit
to chadgates/pyas2-lib
that referenced
this issue
Jan 5, 2022
Hi!
Importing a valid public key ".cer" file, I run into a server 500 error your django pyas2 (v1.2.0)
I switched to debug and found that you do a plain item.decode("utf8").
In utils.py function "extract_certificate_info" you do this e.g. in line 248
cert_info["subject"] = [ tuple(item.decode("utf8") for item in sets) for sets in certificate.get_subject().get_components() ]
If there is a non valid utf8 token in the subject, the function crashes.
The easy fix is to instruct the decode function to escape all non utf8 characters with a simple and convenient parameter in Python 3+:
item.decode("utf8","backslashreplace")
Maybe this can be used for all relevant utf8 decodings
Cheers James
The text was updated successfully, but these errors were encountered: