GeneralizedTime Unrecognized time in OCSP response
pepone opened this issue · 2 comments
pepone commented
I generating a OCSP response
revocation_date = datetime(2021, 9, 15, 10, 3, 43, tzinfo=timezone.utc)
builder = OCSPResponseBuilder('successful', subject_cert, 'revoked', revocation_date)
The base64 response is
MIIB+AoBAKCCAfEwggHtBgkrBgEFBQcwAQEEggHeMIIB2jCBw6IWBBTnQvfMfAz2WahkTa4IdITrQBRJ+BgWMjAyMTA5MTUxMzMzMDAuOTIzODA0WjCBkDCBjTBBMAkGBSsOAwIaBQAEFP4rCoFXQt2cj3BLS7kzmybo6ooGBBTnQvfMfAz2WahkTa4IdITrQBRJ+AIIIw09N6w2y+2hFhgPMjAyMTA5MTUxMDAzNDNaoAMKAQAYFjIwMjEwOTE1MTMzMzAwLjkyMzgwNFqgGBgWMjAyMTA5MjIxMzMzMDAuOTIzODA0WjANBgkqhkiG9w0BAQsFAAOCAQEAoVM64NBjYeBYSdCMCGGvqYy0SXg8FThvhUDnkgpt/u1hO3aRIZbE8HXsrA09lXMq+BHQoylaQyB2NsxwMSeXt+4VV3brWCfLwJfhc0Fh7gDMfcpfK1jVQ9x8d35q43Qx6LLYM6yVvBYOPzzaq7r1e8G3MpNHq/lDnJq33q5HMDTKAYluLGJlfLlcoTNuuxwAjx1+okybSyb07meJO49eK+5WBv/Zs91fYxrxKTEo+NM5YQ7nOMFSJ2XNPquY28rNQcUj4SV8w6Ej0vINYlknkJK/onjnuP4aY+tGRGK/SWhcZviWqUJi2LqlMV50gH3v+5F6ZDKn97K2evOaKanrzA==
According to ASN1 parser https://lapo.it/asn1js/ it contains an invalid generalized time, any hints on what is going on here
Cheers,
Jose
pepone commented
seems is the produce_at time from
ocspbuilder/ocspbuilder/__init__.py
Line 998 in 81e0427
pepone commented
Wonder if this is a problem with generalized time implementation
>>> import base64
>>> import datetime
>>> import asn1crypto.core
>>> d = asn1crypto.core.GeneralizedTime(datetime.datetime.now(datetime.timezone.utc))
>>> base64.b64encode(d.dump())
b'GBYyMDIxMDkxNjEwNTEyOS4wMDQ2ODda'
https://lapo.it/asn1js/#GBYyMDIxMDkxNjEwNTEyOS4wMDQ2ODda
According to https://www.obj-sys.com/asn1tutorial/node14.html fraction should be just 3 decimal places