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

OpenSSL::ASN1.decode supports fractional times & time zones #757

Conversation

segiddins
Copy link
Contributor

Using ASN1_TIME_to_tm added in openssl 1.1.1

Closes #725

Using ASN1_TIME_to_tm added in openssl 1.1.1
@rhenium
Copy link
Member

rhenium commented May 8, 2024

Thank you for working on this! ASN.1 time is extremely liberal and this PR currently doesn't consider some corner cases, where it silently drops information.

Please check the specification for details: https://www.itu.int/rec/T-REC-X.680-202102-I

I noticed ASN.1 GeneralizedTime allows higher precision than microseconds. Time in current versions of Ruby is based on Rational, so it should be able to accurately represent any value.

GeneralizedTime supports "fractional minutes/hours", for example, 201612081934.5Z is equivalent to 20161208193430Z. I've never seen this used in the wild and I doubt if it's worth implementing, but there should be an exception if we don't support it.

Comma instead of period may be used as the decimal separator. This doesn't seem supported by ASN1_TIME_to_tm() and would already result in an ASN1Error. I think this is fine. I want a test case to check this behavior.

@segiddins segiddins closed this Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

OpenSSL::ASN1.decode doesn't correctly parse UTCTime or GeneralizedTime with fractional seconds or a timezone
2 participants