Skip to content
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

-dateopt option only affects x509 -dates option output #18557

Open
hholzgra opened this issue Jun 14, 2022 · 5 comments
Open

-dateopt option only affects x509 -dates option output #18557

hholzgra opened this issue Jun 14, 2022 · 5 comments
Labels
branch: master Merge to master branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 help wanted triaged: documentation The issue/pr deals with documentation (errors)

Comments

@hholzgra
Copy link
Contributor

Version: 3.0.2 on Ubuntu 22.04LTS

After having fixed issue #18553 to make -dateopt iso_8601 actually work I found that this only seems to change the date format for openssl x509 -dates, but not for other output.

E.g. this produces ISO-8601 output as expected:

$ openssl x509 -noout -dates -dateopt iso_8601 -in test/certs/ca-cert.pem 
notBefore=2020-12-12 20:16:50Z
notAfter=2120-12-13 20:16:50Z

But this still produces RFC-822 output instead

$ /usr/local/bin/openssl x509 -noout -text -dateopt iso_8601 -in test/certs/ca-cert.pem | egrep '(Before|After)'
            Not Before: Dec 12 20:16:50 2020 GMT
            Not After : Dec 13 20:16:50 2120 GMT

Similar for openssl crl, the -dateopt format is used for -lastupdate and -nextupdate output, but not when requesting general -text:

$ openssl crl -in test/testcrl.pem -noout -dateopt iso_8601 -lastupdate
lastUpdate=1995-05-02 02:12:26Z

$ openssl crl -in test/testcrl.pem -noout -dateopt iso_8601 -text | grep -i last
        Last Update: May  2 02:12:26 1995 GMT

And while the openssl-ca manual page also mentions the -dateopt option, and set_dateopt() being called in apps/ca.c, I'm not even sure how to have that command produce output with human readable datetime information in it at all ...

@hholzgra hholzgra added the issue: bug report The issue was opened to report a bug label Jun 14, 2022
@t8m t8m added branch: master Merge to master branch triaged: documentation The issue/pr deals with documentation (errors) branch: 3.0 Merge to openssl-3.0 branch and removed issue: bug report The issue was opened to report a bug labels Jun 14, 2022
@t8m
Copy link
Member

t8m commented Jun 14, 2022

IMO this is a documentation issue.

@hholzgra
Copy link
Contributor Author

In that case I'll probably create a follow up feature request to also allow for requesting ISO format output from -text ... ;)

@paulidale
Copy link
Contributor

I'm more tempted to call this a bug. I requested a date format and it wasn't honoured.

@t8m
Copy link
Member

t8m commented Jun 16, 2022

IMO as that would clearly require implementing an X509_print_ex2 function I can hardly see this as a bug. It is clear the intention of the implementation was to affect the date output other than in the certificate text dump.

@t8m t8m added branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 labels Oct 26, 2023
@Joachim-Otahal
Copy link

Thank you for reporting that issue! I was searching a lot how to get iso_8601 (-like) output of -nextupdate from a .CRL .CRT etc for monitoring purposes (PRTG for example). Nothing was found, even in the documentation, and I was a but surprised by that. But here, finally a working example command line which can be universally parsed, in all languages no matter which OS.
Though, as using 3.2 today, iso_8601 and -text still don't combine, so I subscribe and hope!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: master Merge to master branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 help wanted triaged: documentation The issue/pr deals with documentation (errors)
Projects
None yet
Development

No branches or pull requests

5 participants