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

ssh-key: use u64 type for certificate timestamps #209

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

tarcieri
Copy link
Member

Closes #174

Previously certificates only supported the i64 range to allow for infallible conversions to/from SystemTime.

Unfortunately OpenSSH defaults to using u64::MAX as the valid_before time in order to represent certificate that's valid "forever". The previous restriction meant that ssh-key was incapible of parsing such certificates.

This commit switches to using a raw u64 everywhere, and changing conversions to SystemTime to return an Option<SystemTime> which is None if the u64 value overflows an i64.

@tarcieri tarcieri force-pushed the ssh-key/use-u64-type-for-certificate-timestamps branch from 921e105 to 7a80c41 Compare March 29, 2024 19:28
Closes #174

Previously certificates only supported the `i64` range to allow for
infallible conversions to/from `SystemTime`.

Unfortunately OpenSSH defaults to using `u64::MAX` as the `valid_before`
time in order to represent certificate that's valid "forever". The
previous restriction meant that `ssh-key` was incapible of parsing such
certificates.

This commit switches to using a raw `u64` everywhere, and changing
conversions to `SystemTime` to return an `Option<SystemTime>` which is
`None` if the `u64` value overflows an `i64`.
@tarcieri tarcieri force-pushed the ssh-key/use-u64-type-for-certificate-timestamps branch from 7a80c41 to f8760a5 Compare March 29, 2024 23:01
@tarcieri tarcieri merged commit f8bf338 into master Mar 30, 2024
25 checks passed
@tarcieri tarcieri deleted the ssh-key/use-u64-type-for-certificate-timestamps branch March 30, 2024 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ssh_key::Certificate fails to parse certificates created without an expiration date
1 participant