-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
python3 error: Short octet stream on tag decoding #185
Comments
Rather than hold up all forward progress on ASN1 Python3 issues, disable Python3 testing and file a bug to re-enable it. PyASN1 bug: etingof/pyasn1#185 tpm2-pkcs11 bug: tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
Rather than hold up all forward progress on ASN1 Python3 issues, disable Python3 testing and file a bug to re-enable it. PyASN1 bug: etingof/pyasn1#185 tpm2-pkcs11 bug: #327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
In it's in the code that returns the substrate is returning an empty string. def readPemBlocksFromFile(fileObj, *markers):
startMarkers = dict(map(lambda x: (x[1], x[0]),
enumerate(map(lambda y: y[0], markers))))
stopMarkers = dict(map(lambda x: (x[1], x[0]),
enumerate(map(lambda y: y[1], markers))))
idx = -1
substrate = ''
certLines = []
state = stSpam
while True:
certLine = fileObj.readline() The line: certLine = fileObj.readline() never picks up the |
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag. Releates to bug tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag. Releates to bug tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
Interesting! Thank you for troubleshooting this issue! Error message is misleading. I will push a patch and report back. |
@etingof the other issue, is when even when we get past this the data returned later on when accessing the ASN1 sub fields of the cert is str, where we would probably want byte array. I think a better fix would be ensuring that after we decode base64 we ensure that its a bytes and not str.... this py2to3 str/bytes stuff has been fun (not). |
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag and open pem w/o binary mode flag Additionally, python3 and python 2 differe in handling str and bytes and python3 requires more type correctness. Fix all this in a way that works with python2 and python3 Releates to bug tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag and open pem w/o binary mode flag Additionally, python3 and python 2 differe in handling str and bytes and python3 requires more type correctness. Fix all this in a way that works with python2 and python3 Releates to bug tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag and open pem w/o binary mode flag Additionally, python3 and python 2 differe in handling str and bytes and python3 requires more type correctness. Fix all this in a way that works with python2 and python3 Releates to bug #327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
I'm seeing an issue in cert decoding on python3 that I am not seeing on python2:
Which I can reproduce with this certificate:
OpenSSL seems to be fine with the cert:
As well as various SSL cert checker websites, like https://www.sslchecker.com/certdecoder
I've tried a few different versions of python3 (3.5.2 and 3.6.8) and can reproduce with both. Ive also tried different versions of pyasn1 and pyasn1_modules with no luck.
The text was updated successfully, but these errors were encountered: