openwisp / django-x509

Reusable django app implementing x509 PKI certificates management
http://openwisp.org
BSD 3-Clause "New" or "Revised" License
340 stars 69 forks source link

[base/models] Conformation for RFC5280 added #77

Closed pandafy closed 4 years ago

pandafy commented 4 years ago

Added checks for encoding of datetime in proper format as mentioned in RFC5280 standard.

Fixes #53

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.01%) to 99.174% when pulling 5060e55f4af4358fb225bc44c0ad2410f14e8831 on TheOneAboveAllTitan:fixes-53 into bd064e9376e56cbc6f52594fbd158d06ecc8350a on openwisp:master.

pandafy commented 4 years ago

Regarding test for certificate having GeneralizedTime

OpenSSL.crypto.X509.getAfter() and OpenSSL.crypto.X509.getAfter() returns timestamp formatted as ASN.1 TIME irrespective of date format in certificate. Link to documentation.

Kindly have a look on these also Using pyOpenSSL to print validation period dates from certificate Using OpenSSL CLI to print validation period dates from certificate

I have used this certicate having a start date before 2050 and end date after 2050.

Thus, it is not possible to assert the time format in a test. Kindly suggest some other way to test this.